class Solution(object):
    def letterCombinations(self, digits):
        """
        :type digits: str
        :rtype: List[str]
        """
        if len(digits) <= 0:
            return list()
        alpha = ["","1","abc","def","ghi","jkl","mno","pqrs","tuv","wxyz"]
        res=[]
        word=[]
        def dfs(cur):
            if cur >= len(digits):
                res.append(''.join(word))
            else:
                for x in alpha[int(digits[cur])-(int)('0')]:
                    word.append(x)
                    dfs(cur+1)
                    word.pop()
        dfs(0)
        
        return res

@link http://blog.csdn.net/hcbbt/article/details/44061179

相关文章:

  • 2021-12-19
  • 2022-12-23
  • 2021-11-21
  • 2022-02-15
  • 2022-12-23
  • 2021-11-16
猜你喜欢
  • 2021-06-16
  • 2021-11-23
  • 2021-11-24
  • 2021-11-30
  • 2021-10-26
相关资源
相似解决方案