Dynamic Programming Interview Questions & Solutions
40 solutions ยท 5 Easy ยท 29 Medium ยท 6 Hard
Dynamic programming is the pattern candidates fear most, and the one FAANG interviewers lean on hardest to separate strong problem-solvers from the rest. At its core it's simple: when a problem breaks into overlapping subproblems, you solve each subproblem once and reuse the answer instead of recomputing it. The hard part is seeing that structure in the first place โ recognizing that "minimum coins," "longest subsequence," and "number of ways" are all asking you to define a state and a recurrence.
The solutions below walk through that recognition step by step: how to define the DP state, write the transition, choose between top-down memoization and bottom-up tabulation, and reason about time and space. You'll see the classic 1-D problems (climbing stairs, house robber), the 2-D grid and string problems (edit distance, longest common subsequence), and the knapsack family that so many interview questions are secretly variations of. Work through them in order and the recurrences stop feeling like magic and start feeling like a checklist.
- Climbing StairsEasy
- Fibonacci NumberEasy
- Min Cost Climbing StairsEasy
- Pascal's TriangleEasy
- Pascal's Triangle IIEasy
- 2 Keys KeyboardMedium
- Best Time to Buy and Sell Stock with CooldownMedium
- Best Time to Buy and Sell Stock with Transaction FeeMedium
- Can I WinMedium
- Coin ChangeMedium
- Coin Change IIMedium
- Decode WaysMedium
- Edit DistanceMedium
- House RobberMedium
- House Robber IIMedium
- House Robber IIIMedium
- Longest Common SubsequenceMedium
- Longest Increasing SubsequenceMedium
- Longest Palindromic SubsequenceMedium
- Maximal SquareMedium
- Maximum Product SubarrayMedium
- Maximum SubarrayMedium
- Minimum Deletions to Make String BalancedMedium
- Minimum Path SumMedium
- Palindromic SubstringsMedium
- Partition Array for Maximum SumMedium
- Partition Equal Subset SumMedium
- Perfect SquaresMedium
- Target SumMedium
- TriangleMedium
- Unique Binary Search TreesMedium
- Unique PathsMedium
- Unique Paths IIMedium
- Word BreakMedium
- Best Time to Buy and Sell Stock IIIHard
- Burst BalloonsHard
- Interleaving StringHard
- Maximum Profit in Job SchedulingHard
- Regular Expression MatchingHard
- Wildcard MatchingHard
Practice Dynamic Programming the right way
SkillFlow serves you Dynamic Programming problems matched to your level, times you like a real interview, and tracks your proficiency as it climbs. Free.
Start practicing free โ