:type digits: str :rtype: List[str]
(self, digits)
| 34 | """ |
| 35 | class Solution(object): |
| 36 | def letterCombinations(self, digits): |
| 37 | """ |
| 38 | :type digits: str |
| 39 | :rtype: List[str] |
| 40 | """ |
| 41 | maps = { |
| 42 | '2': 'abc', |
| 43 | '3': 'def', |
| 44 | '4': 'ghi', |
| 45 | '5': 'jkl', |
| 46 | '6': 'mno', |
| 47 | '7': 'pqrs', |
| 48 | '8': 'tuv', |
| 49 | '9': 'wxyz' |
| 50 | } |
| 51 | |
| 52 | result = [] |
| 53 | |
| 54 | def reduce_abc(strs, currentStr=""): |
| 55 | if not strs: |
| 56 | return currentStr |
| 57 | else: |
| 58 | for i in maps[strs[0]]: |
| 59 | x = reduce_abc(strs[1:], currentStr=currentStr+i) |
| 60 | if x: |
| 61 | result.append(x) |
| 62 | reduce_abc(digits) |
| 63 | return result |
nothing calls this directly
no outgoing calls
no test coverage detected