Skip to content

Glossary: Coding Interviews in Go

Backtracking

Also written: pattern 14

Building every possible 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 inputs of about 20 items or fewer.

Where the book teaches it

Related terms

PathPruningSubsetExponential time