Dashboard
LC #78
Subsets
Pattern · ?AmazonGoogleMetaBloomberg
Problem
Return all possible subsets (power set) of an array of unique integers.
Constraints
- 1 ≤ n ≤ 10
- -10 ≤ nums[i] ≤ 10
- All values are unique
Example
- Input
- nums = [1, 2, 3]
- Output
- [[], [1], [2], [1,2], [3], [1,3], [2,3], [1,2,3]]
- Why
- Power set: 2³ = 8 subsets total. All values are unique
Spot the pattern
Which pattern cracks it?
Hints
One at a time