HomeBacktracking
Backtracking
Choose, explore, un-choose — walk the tree of all solutions.
12 shown
- OverviewChoose → explore → un-chooseanimatedMedium
- SubsetsEvery node of the tree is a subsetanimatedMedium
- PermutationsChoose an unused element at each levelanimatedMedium
- N-QueensPlace row by row, backtrack on attackanimatedHard
- Practice problems
- Palindrome partitioningCut where the prefix is a palindromeHard
- Word SearchDFS from every cell, undoing as you leaveHard
- N QueenOne queen per column, backtrack on conflictanimatedHard
- Rat in a MazeTry each direction, unmark on the way backHard
- Word BreakSplit off a dictionary word, recurse on the restMedium
- M Coloring ProblemColour a node, check its neighbours, backtrackHard
- Expression Add OperatorsInsert an operator, carry the last term for *Hard
- Solution Space TreesThe tree every backtracking solution walksanimatedMedium