Backtracking Introduction
Last updated
Was this helpful?
Last updated
Was this helpful?
Generally for backtracking problems, we can visualize it as a form of DFS (Depth First Search) where we intially choose a root and explore all the choices for that root
We use a for-loop to iterate through what we are trying to find the combinations of. The for-loop basically goes through the DFS tree.
The for-loop helps us see which root we start at and the recursion calls help us go down that branch, with the help of a pointer