Backtracking Core Idea Backtracking is controlled brute force: dfs(state): if state is complete: record answer return for choice in valid choices from state: choose dfs(next state) undo Common Shapes Pick Or Skip Use when every element has exactly two choices: take it or leave it.
Over a state Use this when recursion places something into a row, cell, grid path, bucket, or slot while constraints decide whether the choice is legal.