Phone Keypad Letter Combinations
MediumBacktracking
Decode it first. Clues, constraints, pattern and plan before any code.On an old phone keypad, each digit from 2 to 9 maps to letters:
2: abc 3: def 4: ghi 5: jkl
6: mno 7: pqrs 8: tuv 9: wxyzGiven a string digits made of the characters 2 to 9, return every string that could be typed by picking one letter per digit, in order. Return them in any order. An empty input gives an empty list.
"23" → ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"]
"2" → ["a", "b", "c"]
"" → []Constraints
0 <= digits.length <= 4digits[i]is a digit from'2'to'9'.