Solution
- For each subsets up to
i-1
, appendnums[i]
to the end of it to find subsets up toi
.def subsets(self, nums): """ :type nums: List[int] :rtype: List[List[int]] """ result = [[]] for num in nums: result += [i + [num] for i in result] return result
PREVIOUSSubsets