Patterns
SC · Pattern 10
Subsets / Combinations
Build all subsets by starting with an empty set and for each element, creating new subsets by adding it to every existing subset (BFS-style expansion).
- Time
- O(n · 2ⁿ)
- Space
- O(n · 2ⁿ)
Spot it when
- Generate all subsets / power set
- Generate all permutations
- Generate all combinations
- Count distinct combinations summing to target
Problems
Easy to hard · 0/5 solved