Pattern · Backtracking

Backtracking interview questions

70 backtracking problems tagged across recent interview reports. Drilled most heavily by amazon, bloomberg, and meta.

Founder's read

Backtracking is the pattern for problems where you explore multiple solution paths, reject branches that violate constraints, and unwind to try alternatives. It's fundamental to combination/permutation generation, constraint satisfaction, and search problems. With 70 problems tagged across this pattern and heavy coverage at Amazon (57 problems), Bloomberg, Meta, Microsoft, and Google, backtracking isn't optional, it's a core skill that shows up in nearly every coding round. If you freeze on a constraint-satisfaction variant during your live OA, StealthCoder solves it invisibly.

Most-asked backtracking problems

#ProblemDiff# Companies
01Generate ParenthesesMEDIUM40
02Letter Combinations of a Phone NumberMEDIUM37
03Combination SumMEDIUM28
04PermutationsMEDIUM26
05N-QueensHARD19
06Restore IP AddressesMEDIUM15
07Combination Sum IIMEDIUM13
08Permutations IIMEDIUM9
09Optimal Account BalancingHARD8
10Path Sum IIMEDIUM8
11CombinationsMEDIUM7
12N-Queens IIHARD7
13Palindrome PartitioningMEDIUM7
14Beautiful ArrangementMEDIUM6
15Robot Room CleanerHARD6
16Remove Invalid ParenthesesHARD5
17Expression Add OperatorsHARD4
18Gray CodeMEDIUM4
1924 GameHARD3
20Binary Tree PathsEASY3
21Brace ExpansionMEDIUM3
22Find Minimum Time to Finish All JobsHARD3
23Maximum Path Quality of a GraphHARD3
24Construct Smallest Number From DI StringMEDIUM2
25Matchsticks to SquareMEDIUM2
26Partition to K Equal Sum SubsetsMEDIUM2
27Additive NumberMEDIUM1
28All Paths From Source to TargetMEDIUM1
29Construct the Lexicographically Largest Valid SequenceMEDIUM1
30Count Number of Maximum Bitwise-OR SubsetsMEDIUM1
31Count Numbers with Unique DigitsMEDIUM1
32Factor CombinationsMEDIUM1
33Fair Distribution of CookiesMEDIUM1
34Find Unique Binary StringMEDIUM1
35Flip Game IIMEDIUM1
36Largest Time for Given DigitsMEDIUM1
37Letter Case PermutationMEDIUM1
38Maximize Score After N OperationsHARD1
39Maximum Good People Based on StatementsHARD1
40Maximum Length of a Concatenated String with Unique CharactersMEDIUM1
41Maximum Points in an Archery CompetitionMEDIUM1
42Maximum Score Words Formed by LettersHARD1
43Minimum Number of Lines to Cover PointsMEDIUM1
44Minimum Number of Work Sessions to Finish the TasksMEDIUM1
45Minimum Time to Break Locks IMEDIUM1
46Next Greater Numerically Balanced NumberMEDIUM1
47Number of Valid Move Combinations On ChessboardHARD1
48Numbers With Same Consecutive DifferencesMEDIUM1
49Path with Maximum GoldMEDIUM1
50Permutations IIIMEDIUM1

Showing top 50 of 70 backtracking problems by # companies asking.

The hedge for the live OA

You can't drill every backtracking variant before the assessment. StealthCoder runs invisibly during screen share and solves whichever variant they throw at you. No browser extension. No detection signature. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too.

Get StealthCoder
What this means

Backtracking problems fall into a few clear buckets: combination/permutation generation (Combinations, Combination Sum I & II), path enumeration (All Paths From Source to Target, Binary Tree Paths), constraint satisfaction (Beautiful Arrangement), and string/sequence construction (Brace Expansion, Construct Smallest Number From DI String). The pattern is recognizable by the ask for 'all valid solutions' or 'all ways to...' rather than a single answer. The recursive structure is always: choose, explore, unchoose. Drill order: start with pure combinations and permutations, move to problems with duplicate-handling, then tackle the constraint-heavy variants. Amazon and Meta lean hardest on backtracking; they'll test both straightforward cases and tricky edge cases like duplicates or tight constraints. When a backtracking problem lands in your live assessment and you hit a wall on pruning logic or state management, StealthCoder reads the constraints and delivers the solution in real time.

Companies that hire most on backtracking

The honest play

70 backtracking problems. You won't drill them all. Pass anyway.

Backtracking is one of the patterns interviews actually filter on. Memorizing every variant in a week is a fantasy. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds, no matter which backtracking flavor lands in your live OA. Made by an Amazon engineer who watched the leaked-problem repo become an industry secret. He decided you should have it too. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Backtracking interview FAQ

How many backtracking problems should I drill before an interview?+

Given 70 problems tagged with this pattern and its dominance at Amazon, Bloomberg, Meta, and Microsoft, aim for 12-15 distinct problems covering combinations, permutations, path-finding, and constraint variants. Focus on understanding the choice/explore/unchoose rhythm rather than memorizing solutions.

How do I recognize a backtracking problem in the wild?+

Look for the phrase 'all valid', 'all combinations', 'all permutations', 'all paths', or 'count all ways'. If the problem asks for multiple solutions (not just one), constraints eliminate branches, and you need to explore then undo, that's backtracking. Check the examples for exponential solution sets.

Which company asks backtracking questions the most?+

Amazon has 57 backtracking problems in the wild, nearly 13 more than the next tier (Bloomberg, Meta, Microsoft at 45 each). If you're interviewing at Amazon, backtracking is non-negotiable. Google (34), TikTok (32), and Uber (30) also test it regularly.

What's the difference between backtracking and dynamic programming?+

Backtracking explores all solution paths and backtracks when a path fails. DP breaks the problem into overlapping subproblems and stores results. Backtracking answers 'find all valid solutions'; DP answers 'what is the optimal value'. They're different tools for different problems.

Do I need to optimize backtracking with memoization?+

Pure backtracking generates all solutions, so memoization doesn't always apply. But if you're counting solutions or recomputing the same subproblems, memoization (top-down DP) can prune the search space. Know when pruning at branch level beats storing results.

Problem and frequency data sourced from public community-maintained interview-report repos. Problems and trademarks © LeetCode.