Python easy to understand simple code


  • 0
    P
    class Solution(object):
        def subsets(self, nums):
            """
            :type nums: List[int]
            :rtype: List[List[int]]
            """ 
            subset = [[]]
            for i in nums:
            	temp = []
            	for j in subset:
            		temp.append(j+[i])
            	subset = subset + temp
            return subset
    

Log in to reply
 

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