Back to problems

Count Unique Morse Translations

Algorithm · Amazon · Easy

Problem You are given a string array named words. Convert a word to Morse code by substituting each character with its Morse representation, then joining those representations from left to right. As an illustration, "dog" is encoded as "-..--- --." without the spaces, since its code is formed by appending "-.." + "---" + "--.". Encode all entries in words, then report how many different encoded strings occur. Input/Output Input: First line: an integer n representing the word…

Checking your access…