Unique Morse Code Words
The Morse code for the letters a to z is, in order:
.- -... -.-. -.. . ..-. --. .... .. .--- -.- .-.. -- -. --- .--. --.- .-. ... - ..- ...- .-- -..- -.-- --..
Translate each word by joining the codes of its letters with no separators. Return how many different translations there are among words.
Example 1
words ["gin","zen","gig","msg"]
returns 2
gin and zen both give --...-., as do gig and msg, so there are 2.
Constraints
1 <= len(words) <= 20- Each word has 1 to 12 lowercase letters
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Hash maps problems
- Unique OccurrencesEasy
- Widest Spread ValueEasy
- Bulls and CowsMedium
- Contiguous ArrayMedium
- Group AnagramsMedium
- Longest Consecutive SequenceMedium
- Longest Zero-Sum StretchMedium
- Rows That Match ColumnsMedium