Skip to content

Glossary: Coding Interviews

Backtracking

Also written: choose, explore, un-choose

A way to list every possible answer by building it one choice at a time: choose an item, explore the rest by recursion, then un-choose it so the next branch starts clean. Its cost is O(2ⁿ), so it suits small inputs.

Where the book teaches it

Related terms

PruningPathSubsetExponential time