class Solution:
def subsets(self, nums: list[int]):
result = [[]]
for num in nums:
result += [r + [num] for r in result]
return result
78. Subsets - LeetCode
ยท One min read
class Solution:
def subsets(self, nums: list[int]):
result = [[]]
for num in nums:
result += [r + [num] for r in result]
return result