Skip to content

Instantly share code, notes, and snippets.

@jooyunghan
Last active January 9, 2018 06:56
Show Gist options
  • Save jooyunghan/701701f4b59bc9597d5609b4a6863a43 to your computer and use it in GitHub Desktop.
Save jooyunghan/701701f4b59bc9597d5609b4a6863a43 to your computer and use it in GitHub Desktop.
const letters = c => ({
0: " ",
1: "",
2: "abc",
3: "def",
4: "ghi",
5: "jkl",
6: "mno",
7: "pqrs",
8: "tuv",
9: "wxyz"
}[c]);
var letterCombinations = function (digits) {
if (digits.length === 0) return [];
return traverse(letters, digits).map(s => s.join(""));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment