Backtracking
24 problems · 18 with full explanations
2 Easy10 Medium6 Hard
Backtracking explores all possible solutions by building candidates incrementally and abandoning ("pruning") branches that cannot lead to a valid result. It powers N-Queens, Sudoku solver, permutations, and subset generation. Prune early to reduce the effective search space.
How to practice
To practice Backtracking problems effectively, start with the Easy problems listed below, trace through each solution on paper, then re-implement without looking. When you can recognise the backtracking pattern within 30 seconds of reading a new problem, move on to Medium difficulty. Use the related topic pages and our study guide for a structured progression.
Start here (Easy + explained)
All Backtracking problems
- 22.Generate ParenthesesMedium
- 37.Sudoku SolverHard
- 40.Combination Sum IIMedium
- 51.N-QueensHard
- 52.N-Queens IIHard
- 113.Path Sum IIMedium
- 126.Word Ladder IIHard
- 212.Word Search IIHard
- 257.Binary Tree PathsEasy
- 386.Lexicographical NumbersMedium
- 401.Binary WatchEasy
- 494.Target SumMedium
- 679.24 GameHard
- 784.Letter Case PermutationMedium
- 1079.Letter Tile PossibilitiesMedium
- 1415.The k-th Lexicographical String of All Happy Strings of Length nUnknown
- 1593.Split a String Into the Max Number of Unique SubstringsMedium
- 1718.Construct the Lexicographically Largest Valid SequenceUnknown
- 1799.Maximize Score After N OperationsUnknown
- 1863.Sum of All Subset XOR TotalsUnknown
- 1980.Find Unique Binary StringMedium
- 2014.Longest Subsequence Repeated k TimesUnknown
- 2044.Count Number of Maximum Bitwise-OR SubsetsMedium
- 2698.Find the Punishment Number of an IntegerUnknown