Concept Flow - Subsets Generation Using Bitmask
Start with input array
Calculate total subsets = 2^n
For each number from 0 to 2^n - 1
Use bits of number as mask
For each bit position
If bit is 1, include element
Add formed subset to result
Repeat until all numbers processed
Return all subsets
We use numbers from 0 to 2^n - 1 as masks. Each bit shows if an element is in the subset.
