<-Topic
Backtracking Problems
Backtracking problems — combinations, permutations, subsets, word search, and constraint-satisfaction puzzles.
Medium · 1
Backtracking is the systematic exploration of a decision tree, with pruning whenever a partial solution can't lead to a valid answer. It's how you solve combinations, permutations, subsets, N-Queens, Sudoku, and word-search problems — anywhere the answer is "find all configurations that satisfy a constraint."
The pattern has a clean template: pick a candidate, recurse, undo. The art is in the pruning — recognizing which partial states are dead ends and bailing out early so the search doesn't blow up exponentially. Pair backtracking with a trie or hash set to prune even more aggressively.
The Ratta backtracking track covers Subsets, Combinations, Permutations, Word Search, Letter Combinations of a Phone Number, N-Queens, and Sudoku Solver. Every solution shows the canonical template — pick, recurse, unpick — and includes the pruning conditions that make the difference between a passing and a TLE submission. Available in C++, Java, Python, and Go.