Pattern · Dynamic Programming

Dynamic Programming interview questions

332 dynamic programming problems tagged across recent interview reports. Drilled most heavily by amazon, google, and tiktok.

Founder's read

Dynamic Programming is the pattern behind 332 interview problems and dominates assessments at Amazon, Google, and TikTok. It's a method for solving optimization problems by breaking them into overlapping subproblems, storing results to avoid recomputation, and building up to the final answer. The pattern shows up everywhere: stock trading, string matching, matrix traversal, tree construction. Most candidates drill it late and hit it unprepared in the live OA. StealthCoder reads the problem and solves it invisible to the proctor, turning a panic moment into a clean submission.

Most-asked dynamic programming problems

#ProblemDiff# Companies
01Best Time to Buy and Sell StockEASY120
02Coin ChangeMEDIUM37
03Climbing StairsEASY36
04Best Time to Buy and Sell Stock IIMEDIUM34
05Binary Tree Maximum Path SumHARD27
06Best Time to Buy and Sell Stock IIIHARD12
07Best Time to Buy and Sell Stock IVHARD9
08Binary Tree CamerasHARD9
09Cheapest Flights Within K StopsMEDIUM9
10Burst BalloonsHARD7
11Cherry PickupHARD7
12Beautiful ArrangementMEDIUM6
1301 MatrixMEDIUM5
14Best Time to Buy and Sell Stock with CooldownMEDIUM4
15Count Palindromic SubsequencesHARD4
16Best Time to Buy and Sell Stock with Transaction FeeMEDIUM3
17Airplane Seat Assignment ProbabilityMEDIUM2
18Arithmetic Slices II - SubsequenceHARD2
19As Far from Land as PossibleMEDIUM2
20Build Array Where You Can Find The Maximum Exactly K ComparisonsHARD2
21Cherry Pickup IIHARD2
22Closest Subsequence SumHARD2
23Concatenated WordsHARD2
24Construct the Longest New StringMEDIUM2
25Count All Valid Pickup and Delivery OptionsHARD2
26Count Number of TeamsMEDIUM2
27Count of IntegersHARD2
282 Keys KeyboardMEDIUM1
29All Possible Full Binary TreesMEDIUM1
30Apply Operations to Make Two Strings EqualMEDIUM1
31Arithmetic SlicesMEDIUM1
32Best Sightseeing PairMEDIUM1
33Best Team With No ConflictsMEDIUM1
34Bitwise ORs of SubarraysMEDIUM1
35Can I WinMEDIUM1
36Champagne TowerMEDIUM1
37Check if an Original String Exists Given Two Encoded StringsHARD1
38Check if There is a Valid Partition For The ArrayMEDIUM1
39Choose Edges to Maximize Score in a TreeMEDIUM1
40Coin Change IIMEDIUM1
41Combination Sum IVMEDIUM1
42Constrained Subsequence SumHARD1
43Construct String with Minimum CostHARD1
44Count Different Palindromic SubsequencesHARD1
45Count Increasing QuadrupletsHARD1
46Count Number of TextsMEDIUM1
47Count Number of Ways to Place HousesMEDIUM1
48Count Numbers with Unique DigitsMEDIUM1
49Count Paths That Can Form a Palindrome in a TreeHARD1
50Count Square Submatrices with All OnesMEDIUM1

Showing top 50 of 332 dynamic programming problems by # companies asking.

The hedge for the live OA

You can't drill every dynamic programming 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 for the engineer who has done the work but might still blank with a webcam pointed at him.

Get StealthCoder
What this means

Dynamic Programming problems live in two worlds: memoization (top-down, recursive) and tabulation (bottom-up, iterative). The signature tell is when a naive recursive solution has exponential complexity because it recalculates the same state thousands of times. You'll recognize it in problems like Best Time to Buy and Sell Stock, Arithmetic Slices, and 01 Matrix. The drill order matters: start with 1D DP (linear sequences), move to 2D DP (grids and pairs), then tackle decision DP (when to buy, when to skip). Amazon and Goldman Sachs weight this pattern heavily. When you hit a DP variant in your live assessment that you haven't drilled, StealthCoder solves it in seconds while you paste and format.

Companies that hire most on dynamic programming

The honest play

332 dynamic programming problems. You won't drill them all. Pass anyway.

Dynamic Programming 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 dynamic programming flavor lands in your live OA. Made for the engineer who has done the work but might still blank with a webcam pointed at him. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Dynamic Programming interview FAQ

How many dynamic programming problems should I drill before an OA?+

With 332 problems tagged DP, you won't drill all of them. Target 20-30 core problems: 8-10 on 1D DP (stock, stairs, climbing), 8-10 on 2D DP (paths, matrix), 5-8 on decision/state DP. Focus on problems that feel unfamiliar each time you solve them.

Which company drills dynamic programming the hardest?+

Amazon asks 95 DP problems in their interview pool, more than any other company. Google, TikTok, and D.E. Shaw each ask 80-plus. If you're targeting these companies, DP fluency isn't optional.

How do I recognize a dynamic programming problem in an interview?+

Look for optimization (max, min, count ways), constraints that rule out brute force, and a state space you can define. If you write a recursive solution and realize you're solving the same subproblem twice, it's DP. Problems like Best Sightseeing Pair and Arithmetic Slices all fit this pattern.

Is dynamic programming the most important pattern for Amazon and Google?+

It's in the top tier. Amazon has 95 DP problems in their bank, but they also ask arrays, trees, and graphs. DP is the hardest to improvise on live, which is why it's critical to drill and why having a safety net matters.

Should I memorize DP solutions or understand the logic?+

Understand the logic. Memorizing code doesn't transfer to variants. You need to recognize the recurrence relation and state definition. Understanding why Best Time to Buy and Sell Stock uses dp[i] = max profit by day i trains you for the hard variant that shows up under time pressure.

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