FunctionRacerProblemsRace

Unique Morse Code Words

EasyHash mapsPython, JavaScript, TypeScript, Java, C++

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

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More Hash maps problems