solution-space tree
ad
ae
af
a
bd
be
bf
b
cd
ce
cf
c
“ ”
combinations
(none yet)
Backtracking · one digit per level
▸1combine(index, path):2 if index == len(digits):3 record path // a full combination (leaf)4 return5 for letter in keypad[digits[index]]:6 path.push(letter) // choose7 combine(index+1, path) // explore next digit8 path.pop() // un-choose (backtrack)
state
- digits"23"
- 2abc
- 3def