Intermediate Dynamic Programming Problems for Coding Interviews
97 intermediate Dynamic Programming problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 97 intermediate and 0 advanced. The companies that ask them most often are Google, Meta, Amazon, Microsoft.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Coin Change (Intermediate)
- Min Cost Climbing Stairs (Intermediate)
- Maximum Coins From Triples (Intermediate)
- Minimum Coin Count With Limited Inventory (Intermediate)
- Minimum Cost to Paint Houses (Intermediate)
- Most Competitive Subsequence (Intermediate)
- Minimum Cost to Connect Network (Intermediate)
- Coin Change Ways (Intermediate)
- Zero One Knapsack (Intermediate)
- Longest Palindromic Subsequence (Intermediate)
- Maximum Sum Increasing Subsequence (Intermediate)
- Count Ways to Tile Board (Intermediate)
- Minimum Cost Path With Portals (Intermediate)
- Minimum Cost to Reach Destination With Fuel (Intermediate)
- Minimum Cost to Make Strings Equal (Intermediate)
- Longest Repeated Subsequence (Intermediate)
- Minimum Cost to Cut a Board (Intermediate)
- Minimum Cost to Collect All Keys (Intermediate)
- Minimum Cost to Reach Target With Coupons (Intermediate)
- Count Ways to Form Target From Columns (Intermediate)
- Minimum Cost to Type a String (Intermediate)
- Find Intersection of Three Sorted Arrays (Intermediate)
- Split Array Into Consecutive Subsequences (Intermediate)
- Longest Increasing Subsequence Count (Intermediate)
- Minimum Cost Maximum Flow (Intermediate)
- Maximum Twin Sum of a Linked List (Intermediate)
- Distribute Coins in Binary Tree (Intermediate)
- Paint Fence Ways (Intermediate)
- Longest Ideal Subsequence (Intermediate)
- Maximum Alternating Subsequence Sum (Intermediate)
- Count Palindromic Partitions (Intermediate)
- Paint N x 3 Grid (Intermediate)
- Count Ways to Distribute Candies (Intermediate)
- Wiggle Subsequence Length (Intermediate)
- Ways to Split Array Into Good Subarrays (Intermediate)
- Count Ways to Build Good Strings (Intermediate)
- Number of Ways to Select Buildings (Intermediate)
- Number of Matching Subsequences (Intermediate)
- Furthest Building You Can Reach (Intermediate)
- Increasing Triplet Subsequence (Intermediate)
- Subsequences With Min Plus Max At Most Target (Intermediate)
- Maximum Number of Removable Characters (Intermediate)
- Max Length of Concatenated Unique Characters (Intermediate)
- Detect Squares (Intermediate)
- Memory Allocator (Intermediate)
- Page Replacement LRU Faults (Intermediate)
- Good Ways to Split a String (Intermediate)
- Unbounded Knapsack (Intermediate)
- Bounded Knapsack With Item Counts (Intermediate)
- Longest Arithmetic Subsequence of Given Difference (Intermediate)
- Minimum Cost Tree From Leaf Values (Intermediate)
- Ways to Divide a Long Corridor (Intermediate)
- Ways to Reach a Position After Exactly K Steps (Intermediate)
- Unique Length-3 Palindromic Subsequences (Intermediate)
- Count Ways to Group Overlapping Ranges (Intermediate)
- Minimum Coins for Fruits (Intermediate)
- Stirling Numbers of the Second Kind (Intermediate)
- Bell Number (Intermediate)
- Integer Partitions Count (Intermediate)
- Partitions Into Distinct Parts (Intermediate)
- Tile a 3 by N Board With Dominoes (Intermediate)
- Longest Uncommon Subsequence II (Intermediate)
- Z Array of a String (Intermediate)
- Maximum Beauty After Operation (Intermediate)
- Ways to Make a Fair Array (Intermediate)
- Fibonacci Modulo With Huge Index (Intermediate)
- Ways to Split Binary String Into Three Equal Parts (Intermediate)
- Minimum Cost to Reach Top With One Triple Jump (Intermediate)
- Longest Bitonic Subsequence (Intermediate)
- Ways to Express N as Sum of Distinct Squares (Intermediate)
- Minimum Cost to Reach End With Jump Limit (Intermediate)
- Minimum Coins With Limited Supply (Intermediate)
- Minimum Cost to Traverse Rows With Column Jump Limit (Intermediate)
- Two Knights Placement Count (Intermediate)
- Count Queen Placements on Blocked Chessboard (Intermediate)
- Coin Redistribution Moves on Tree (Intermediate)
- Staircase Nim Winner (Intermediate)
- Expected Duration of Gamblers Ruin (Intermediate)
- Expected Flips Until Consecutive Heads (Intermediate)
- Probability of Even Heads Count (Intermediate)
Related
Frequently asked questions
How do I get good at dynamic programming problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run dynamic programming problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.