17. Letter Combinations of a Phone Number
Practice Letter Combinations of a Phone Number for free on NudgeCode: Medium, Backtracking pattern. Write it in Python or JavaScript, run the tests in your browser, and ask for a hint when you are stuck.
On a phone keypad, 2 maps to abc, 3 to def, 4 to ghi, 5 to jkl, 6 to mno, 7 to pqrs, 8 to tuv and 9 to wxyz. Given a string of digits from 2 to 9, return every letter string it could spell. Return [] for an empty input. The strings can be in any order.
Example
digits = "23" -> ["ad","ae","af","bd","be","bf","cd","ce","cf"]
Constraints
- 0 <= digits.length <= 4
- Each digit is between 2 and 9