https://leetcode.com/problems/unique-morse-code-words/description/
Solution 1.
/**
 * @param {string[]} words
 * @return {number}
 */
var uniqueMorseRepresentations = function (words) {
  if (words.length === 1) {
    return 1;
  }
  const wordMorse = [];
  let currentMorse = '';
  for (const word of words) {
    currentMorse = '';
    for (let i = 0; i < word.length; i++) {
      currentMorse += morse[word[i].charCodeAt(0) - 97];
    }
    wordMorse.push(currentMorse);
  }
  return new Set(wordMorse).size;
};
const morse = [
  '.-',
  '-...',
  '-.-.',
  '-..',
  '.',
  '..-.',
  '--.',
  '....',
  '..',
  '.---',
  '-.-',
  '.-..',
  '--',
  '-.',
  '---',
  '.--.',
  '--.-',
  '.-.',
  '...',
  '-',
  '..-',
  '...-',
  '.--',
  '-..-',
  '-.--',
  '--..',
];
Runtime 103 ms Beats 50.94%
Memory 42.9 MB Beats 82.45%