Tap here to switch tabs
Problem
Submissions

Problem: Unique Morse Code Words

med
30 min
Try to solve the Unique Morse Code Words problem.

Statement

International Morse Code maps each of the 2626 lowercase English letters to a unique sequence of dots and dashes as follows:

[".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."]

Each element in the sequence corresponds to a letter from 'a' through 'z' in alphabetical order.

The transformation of a word is formed by concatenating the Morse code representations of each of its individual characters.

Given an array of strings words, return the number of distinct Morse code transformations formed by all words in words.

Constraints:

  • 1≤1 \leq words.length ≤100\leq 100

  • 1≤1 \leq words[i].length ≤12\leq 12

  • words[i] consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Unique Morse Code Words

med
30 min
Try to solve the Unique Morse Code Words problem.

Statement

International Morse Code maps each of the 2626 lowercase English letters to a unique sequence of dots and dashes as follows:

[".-", "-...", "-.-.", "-..", ".", "..-.", "--.", "....", "..", ".---", "-.-", ".-..", "--", "-.", "---", ".--.", "--.-", ".-.", "...", "-", "..-", "...-", ".--", "-..-", "-.--", "--.."]

Each element in the sequence corresponds to a letter from 'a' through 'z' in alphabetical order.

The transformation of a word is formed by concatenating the Morse code representations of each of its individual characters.

Given an array of strings words, return the number of distinct Morse code transformations formed by all words in words.

Constraints:

  • 1≤1 \leq words.length ≤100\leq 100

  • 1≤1 \leq words[i].length ≤12\leq 12

  • words[i] consists of lowercase English letters.