Last active
January 9, 2018 06:56
-
-
Save jooyunghan/701701f4b59bc9597d5609b4a6863a43 to your computer and use it in GitHub Desktop.
LeetCode problem https://leetcode.com/problems/letter-combinations-of-a-phone-number/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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