Given an integer array
nums
of uniqueelements, return all possible subsets (the power set).The solution set must not contain duplicate subsets. Return the solution in any order.
class Solution:
def subsets(self, nums):
dp = [[]]
for n in nums:
temp = []
# add each number to existing sol
for x in dp:
temp.append(x+[n])
dp += temp
return dp