notexOPENOverview
Notex/Languages/Practice: Strings and Maps
01.29LESSON 29 OF 33 · 1 MIN READ

Practice: Strings and Maps

Always free to read

The following exercises cover strings and maps.

  1. For s:= "café", print len(s) and len([]rune(s)). Explain the difference using what you know about UTF-8.

  2. Convert the string "Go ߦ顢 to []byte and []rune. Print both representations, then convert each back to a string and confirm the round-trip matches the original.

  3. Use a map as a set to compute the union of []int{1, 2, 3, 4} and []int{3, 4, 5, 6} as a deduplicated []int. Order doesn’t matter.

Progress is saved on this device.
KEEP EXPLORING

One note leads to another.

Back to the library →
⌕
Search across the entire library ⌘ K