Unique Morse Code Words
Solve this the way you would in the interview: out loud, on a timer, with an AI interviewer asking follow-ups while you code. You get a scored report at the end.
Practice this as a mock interviewFree to start, no account neededProblem
International Morse code maps each lowercase letter to a string of dots and dashes:
a = .-, b = -..., c = -.-., d = -.., e = ., f = ..-., g = --., h = ...., i = .., j = .---, k = -.-, l = .-.., m = --, n = -., o = ---, p = .--., q = --.-, r = .-., s = ..., t = -, u = ..-, v = ...-, w = .--, x = -..-, y = -.--, z = --...
A word's transformation is the concatenation of the codes of its letters, with no separators. For example, "cab" becomes "-.-." + ".-" + "-..." = "-.-..--...".
Given an array of words, return how many different transformations appear among them. Different words can share a transformation.
Examples
Constraints
- 1 <= words.length <= 100
- 1 <= words[i].length <= 12
- `words[i]` consists of lowercase English letters
What the interviewer grades
A correct solution is one of five scores. The report also grades problem understanding (did you clarify inputs and edge cases before coding), problem solving, communication while you work, code quality, and testing. See a sample report, or read up on the pattern in the lessons.