Skip to content

Backtracking

Problem Complexity Key Pattern
Combination Sum O(2^target) (bounded by target / min(candidates)) Partition into target — "all combinations summing to T", "coin change
N Queens O(n!) (with pruning) Constraint placement — "place N items with mutual exclusion constraints",
Permutations O(n * n!) All orderings — "generate all permutations", "all arrangements",
Subsets O(n * 2^n) Power set / feature combinations — "generate all subsets", "all