[Leetcode]Letter Combinations of a Phone Number
Given a digit string, return all possible letter combinations that the number could represent.
A mapping of digit to letters (just like on the telephone buttons) is given below.
1
2Input:Digit string "23"
Output: ["ad", "ae", "af", "bd", "be", "bf", "cd", "ce", "cf"].
Note:
Although the above answer is in lexicographical order, your answer could be in any order you want.
解题思路:
使用backtracking,从后往前将所有的手机号码对应的字母返回给前一个号码,将其组合获得结果
1 | kvmaps = {'1': '*', |