Subsets

Given an integer array of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets.

Constraints

  • 1 <= nums.length <= 10
  • -10 <= nums[i] <= 10
  • All the numbers of nums are unique.
Saving… · 2 lines
class Solution:
def generateSubsets(self, nums: List[int]) -> List[List[int]]:
Console

Click Run to execute sample tests.