Backtracking Visualizers

12

Step through every Backtracking problem with animated runtime state, source highlighting, and curated test cases. Built for coding-interview prep and durable algorithmic intuition.

Combination Sum
Find all unique combinations that sum to target using candidates an unlimited number of times.
Backtracking (Unlimited Reuse)
Combination Sum II
Find unique combinations summing to target where each candidate is used at most once.
Backtracking (Duplicates Warning)
Combination Sum III
Find valid combinations of k numbers (1-9) that sum up to n without reusing digits.
Backtracking (Fixed Bounds)
Combinations
Find all possible combinations of k numbers out of the range [1, n].
Backtracking (Fixed Length)
Letter Combinations of a Phone Number
Iterate over digit mappings to generate all combinations representing the phone number.
Backtracking (Multi-branch)
N-Queens
Place N queens on an NxN board so none attack each other, using sets for diagonals.
Backtracking (2D Constraints)
Palindrome Partitioning
Slice every prefix of the remainder as a candidate, verify it's a palindrome with two pointers, then recurse on the suffix — choose, explore, un-choose.
Backtracking (Substring cuts)
Permutations
Generate all possible permutations of an array by trying every unused element in each slot.
Backtracking (Permutations)
Permutations II
Generate all unique permutations by sorting the input and recursing with a functionally-sliced `choices` array — dedup collapses to a `choices[i] === choices[i-1]` sibling-skip.
Backtracking (Skipping Permutation Duplicates)
Subsets
Generate all possible subsets (the power set) by exploring include and exclude decisions recursively.
Backtracking (Include/Exclude)
Subsets II
Generate all unique subsets from an array that may contain duplicates by sorting and skipping.
Backtracking (Subsets with Duplicates)
Word Search
DFS over a grid with mark-and-restore: stamp '#' on the current cell, probe the 4 neighbors for the next character, then put the original back on the way out.
Backtracking (2D Grid DFS)