Share my easy-to-understand python solution


  • 0
    G

    '''

    class Solution(object):
        def letterCombinations(self, digits):
            if not digits: return []
            lookup={'1':'','2':'abc','3':'def','4':'ghi','5':'jkl','6':'mno','7':'pqrs','8':'tuv','9':'wxyz'}
            res=['']
            for d in digits:
                res=[i+ch for i in res for ch in lookup[d]]
            return res
    

    '''


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.