Skip to content

Glossary: Coding Interviews in Rust

Backtracking

Also written: choose, explore, un-choose

Building every answer one choice at a time: choose an item, explore the rest by recursion, then un-choose it so the next branch starts clean. It costs O(2ⁿ), so it suits small inputs such as Sam's gift boxes.

Where the book teaches it

Related terms

PathPruningSubsetExponential time