My first instinct was to overcomplicate it.
Use a hash map to store the Morse code for each letter, then for each word, translate it by concatenating the Morse codes of its letters. Insert each translation into a hash set to automatically deduplicate, and finally return the size of the set.
Pro tip: Clarify edge cases upfront: empty input list, empty strings, and non-alphabetic characters. Also, mention that the Morse code for each letter is fixed and unique, so the translation is deterministic.
Ask about input constraints: can words be empty? Are there non-letter characters? What is the maximum length? This shows attention to detail.
Use a hash map for letter-to-Morse mapping (constant time lookup) and a hash set to store distinct translations (automatic deduplication).
Iterate through each word, and for each character, look up its Morse code and append to a string builder. Handle any invalid characters appropriately.
Add each translated string to the set. After processing all words, return the set's size.
Time complexity is O(N * L) where N is number of words and L is average length. Space complexity is O(N * L) for the set. Mention potential optimizations if needed.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.