Python super easy 5-line recursion beats 99%


  • 0
    W

    '''

    def subsets(self, nums):
        if not nums: return [[]]
        r = self.subsets(nums[1:])
        for i in range(len(r)):
            r.append(r[i]+[nums[0]])
        return r
    

    '''


Log in to reply
 

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