Backtracking

Build an answer one choice at a time, and undo the last choice when it leads nowhere. The tell is a request to list every subset, arrangement or valid combination, as in Subsets and Permutations. Pruning bad branches early keeps the search manageable.

20 problems · 5 with a video · 3 to practice in an AI round

Backtracking problems
#ProblemDifficultyVideoAI round
1Generate ParenthesesMedium—AI round
2Combination SumMedium—
3Letter Combinations of a Phone NumberMedium—
4PermutationsMediumAI round
5SubsetsMediumAI round
6Word SearchMedium—
7N-QueensHard—
8Palindrome PartitioningMedium—
9Target SumMedium
10Combination Sum IIMedium—
11Sudoku SolverHard—
12Subsets IIMedium
13Permutations IIMedium
14CombinationsMedium—
15Path Sum IIMedium—
16Word Ladder IIHard—
17Remove Invalid ParenthesesHard—
18Restore IP AddressesMedium—
19Robot Room CleanerHard—
20Optimal Account BalancingHard—

Practice in an AI round

Three of these are AI rounds: 30 minutes, an AI agent beside your code, then a scored report.

Practice Generate Parentheses in an AI round