Stage 1 · Code
Backtracking
Subsets
Generate all subsets using backtracking and bit manipulation.
Backtracking Approach
For each element, decide to include or exclude. Recurse to next index. When index reaches n, add current subset to result.
Bit Manipulation
Each subset corresponds to a bitmask of length n. 0 to 2^n-1 covers all subsets. Bit i set = include nums[i].
Iterative Approach
Start with empty subset. For each number, create new subsets by appending it to all existing subsets.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.