Subsets
Medium
LC #78
subsetspower setNot attempted yet
Given a list nums of distinct integers, return all
of its subsets (the power set). The result must not
contain the same subset twice. Return the subsets in any
order; the numbers inside a subset may be in any order too.
Example 1
Input: nums = [1,2,3]
Output: [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]]
Example 2
Input: nums = [0]
Output: [[],[0]]
Example 3
Input: nums = [5,-1]
Output: [[],[5],[-1],[5,-1]]
Constraints
- 1 ≤ len(nums) ≤ 10
- -10 ≤ nums[i] ≤ 10
- All numbers are distinct.