Essential Dynamic Programming Problems for SDE Interviews
If you're gearing up for placement season or trying to finally conquer DP (we've all been there!), I've compiled a list of hand-picked problems that cover the depth and breadth of dynamic programming.
Connect with me on LinkedIn to stay updated with more coding resources, interview tips, and problem-solving strategies!
This isn't a guaranteed ticket to ace every DP question. DP is hard, arguably the hardest topic in DSA interviews. But these are the standard problems and patterns that keep showing up in actual interviews, coding assessments, and company hiring tests.
I've organized these by pattern types because that's how your brain will work during interviews. You won't think "ah, this is LeetCode #123." You'll think "this looks like a path-counting problem" or "this feels like interval DP."
Not too many problems to overwhelm you. Not too few to leave gaps. Just the focused set you need to build that DP intuition.
Let's crack DP together!
Problem List by Pattern
1. 1D DP - Fundamentals
- Climbing Stairs
- Min Cost Climbing Stairs
- House Robber
- House Robber II
- Maximum Product Subarray
- Longest Increasing Subsequence
- Jump Game
- Jump Game II
- Decode Ways
- Coin Change
- Coin Change 2
- Perfect Squares
- Partition Equal Subset Sum
- Dice Roll Simulation
- Removing Digits
2. 2D DP - Grid & Matrix Problems
- Unique Paths
- Unique Paths II
- Minimum Path Sum
- Maximum Square
- Dungeon Game
- Triangle
- Minimum Falling Path Sum
- Cherry Pickup
- Cherry Pickup II
- Grid Paths
3. Knapsack Problems (0/1, Unbounded, Variants)
- Target Sum
- Last Stone Weight II
- Ones and Zeroes
- Combination Sum IV
- Profitable Schemes
- Tallest Billboard
- Book Shop
- Array Description
4. Longest Common Subsequence (LCS) Variants
- Longest Common Subsequence
- Edit Distance
- Delete Operation for Two Strings
- Minimum ASCII Delete Sum for Two Strings
- Distinct Subsequences
- Shortest Common Supersequence
- Longest Palindromic Subsequence
- Minimum Insertion Steps to Make a String Palindrome
- Interleaving String
- Uncrossed Lines
5. Palindrome DP
- Longest Palindromic Substring
- Palindromic Substrings
- Palindrome Partitioning II
- Palindrome Removal
- Count Different Palindromic Subsequences
- Longest Palindromic Subsequence II
6. String DP (Beyond LCS)
- Regular Expression Matching
- Wildcard Matching
- Scramble String
- Distinct Subsequences II
- Number of Ways to Form a Target String Given a Dictionary
- Edit Distance
7. Stock Problems (State Machine DP)
- Best Time to Buy and Sell Stock
- Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock III
- Best Time to Buy and Sell Stock IV
- Best Time to Buy and Sell Stock with Cooldown
- Best Time to Buy and Sell Stock with Transaction Fee
8. DP on Trees
- House Robber III
- Binary Tree Maximum Path Sum
- Unique Binary Search Trees
- Unique Binary Search Trees II
- Longest Univalue Path
- Binary Tree Cameras
- Tree Diameter
- Tree Distances I
- Tree Distances II
9. Interval DP
- Minimum Cost Tree From Leaf Values
- Burst Balloons
- Remove Boxes
- Strange Printer
- Minimum Cost to Merge Stones
- Predict the Winner
- Stone Game
- Stone Game II
10. Digit DP
- Count Numbers with Unique Digits
- Non-negative Integers without Consecutive Ones
- Numbers At Most N Given Digit Set
- Numbers With Repeated Digits
- Count Special Integers
11. Bitmask DP
- Partition to K Equal Sum Subsets
- Shortest Path Visiting All Nodes
- Find the Shortest Superstring
- Number of Ways to Wear Different Hats to Each Other
- Minimum Cost to Connect Two Groups of Points
- Maximum Students Taking Exam
- Hamming Distance
- Elevator Rides
12. DP with Optimization Tricks
- Maximal Rectangle
- Largest Rectangle in Histogram
- Russian Doll Envelopes
- Maximum Height by Stacking Cuboids
- Number of Longest Increasing Subsequence
- Longest Arithmetic Subsequence
- Longest Arithmetic Subsequence of Given Difference
13. Probability & Expected Value DP
14. Game Theory DP
- Divisor Game
- Stone Game III
- Stone Game IV
- Stone Game V
- Stone Game VI
- Stone Game VII
- Nim Game
- Can I Win
15. Advanced DP Patterns
- Frog Jump
- Split Array Largest Sum
- Count of Range Sum
- Freedom Trail
- Minimum Swaps To Make Sequences Increasing
- Paint House III
- Number of Music Playlists
- Number of Ways to Reorder Array to Get Same BST
- Count All Valid Pickup and Delivery Options
- Constrained Subsequence Sum
16. Competitive Programming DP Classics
- Dice Combinations
- Minimizing Coins
- Coin Combinations I
- Coin Combinations II
- Two Sets II
- Rectangle Cutting
- Money Sums
- Counting Towers
- Projects
- Increasing Subsequence
- ABC 129 C - Typical Stairs
- ABC 153 E - Crested Ibis vs Monster
- ABC 167 E - Colorful Blocks
- ABC 179 D - Leaping Tak
- ABC 184 E - Third Avenue
- Educational DP Contest
- CF - Xenia and Ringroad
- CF - Mashmokh and ACM
- CF - R2D2 and Droid Army
- CF - Maximum Absurdity
Why This List Works
Pattern-Based Organization: Each section focuses on a specific DP pattern, making it easier to build mental models and recognize similar problems during interviews.
Progressive Difficulty: Within each pattern, problems range from fundamental to advanced, allowing you to build confidence gradually.
Comprehensive Coverage: From 1D DP fundamentals to advanced bitmask DP and game theory, this list covers all major DP patterns you'll encounter in interviews.
Competitive Programming: The CSES, AtCoder, and Codeforces problems provide additional challenge and help you develop speed and accuracy under time constraints.
Final Thoughts
Don't just memorize solutions. Understand the transitions. That's what separates those who "get" DP from those who struggle with it.
This list represents the most important DP problems you should solve before interviews. It's not about quantity, it's about building strong pattern recognition and problem-solving intuition.
DP is hard, but with focused practice on these patterns, you'll develop the intuition needed to tackle any DP problem in interviews.
Let's connect on LinkedIn - I regularly share interview tips, problem-solving strategies, and coding resources that can help accelerate your preparation!
You've got this!