Subsets
medium 22 minGenerating every subset is the first backtracking pattern most interviews ask for, and there are four standard ways to write it: take-or-skip recursion, a start-index loop, iterative cascading and bitmask counting.
Every way to generate subsets
Read it, run it, change a line and run it again.
Loading editor…
The four standard patterns and Subsets II in one file. They all produce the same subsets; only the order differs.