class Solution:
def letterCombinations(self, digits: str) -> List[str]:
pad = {
"2": "abc",
"3": "def",
"4": "ghi",
"5": "jkl",
"6": "mno",
"7": "pqrs",
"8": "tuv",
"9": "xwyz"
}
if not digits:
return []
if len(digits) == 1:
return list(pad[digits])
combs = []
d = digits[0]
loc = self.letterCombinations(digits[1:])
for l in pad[d]:
for c in loc:
combs.append(l + c)
return combs