Current Number Being Built
_
Generated Numbers
Make choices to generate numbers...
📚 Generating All Combinations
Use backtracking to generate all N-digit numbers using only digits 1
and 2:
- At each position, we have 2 choices: place 1 or place 2
- This creates a binary recursion tree
- Total combinations = 2^N
- When we reach N digits, we have a complete number
- Backtrack and try other choices