Skip to main content
Dynamic ProgrammingLeetCodeFAANG

30 Dynamic Programming LeetCode Problems You Must Know [2026]

· 10 min read

Syed Peera Saheb

Software Engineer · 5+ years in tech interviews

Summary

DP is the most feared interview topic. This curated list of 30 problems covers every DP pattern that appears at Google, Meta, and Amazon.

Why DP problems are different

Unlike most patterns where the template is fixed, DP requires you to invent the state definition for each problem. That is why it feels harder — there is no single template. But there ARE recurring archetypes. Once you recognize "this is a 1D knapsack variant" or "this is an LCS-style 2D problem", you can solve any variation. These 30 problems cover every archetype that appears in interviews.

1D DP — Classic problems

These are the entry point. Climbing Stairs (LC 70) — the "hello world" of DP. House Robber (LC 198) — introduces the skip-or-take recurrence. Coin Change (LC 322) — unbounded knapsack archetype. Longest Increasing Subsequence (LC 300) — O(n²) DP or O(n log n) with patience sort. Word Break (LC 139) — string segmentation DP. Min Cost Climbing Stairs (LC 746). Jump Game (LC 55) and Jump Game II (LC 45).

2D DP — Grid and string problems

Unique Paths (LC 62) — grid DP warmup. Minimum Path Sum (LC 64). Longest Common Subsequence (LC 1143) — the foundation of diff algorithms. Edit Distance (LC 72) — one of the most common Google questions. Interleaving String (LC 97). Regular Expression Matching (LC 10) — hard but frequently asked at Google.

Knapsack variants

0/1 Knapsack — Partition Equal Subset Sum (LC 416). Unbounded Knapsack — Coin Change (LC 322), Coin Change II (LC 518). Target Sum (LC 494) — count subsets with given sum. Last Stone Weight II (LC 1049). These all reduce to the same template: dp[i] = can we achieve sum i using available items?

Tree and interval DP

Unique BSTs (LC 96) — Catalan number DP. Burst Balloons (LC 312) — interval DP, hard but canonical. Palindrome Partitioning II (LC 132). Matrix Chain Multiplication — classic interval DP pattern. For trees: House Robber III (LC 337) — tree DP where state is (rob this node, skip this node).

State machine DP

Best Time to Buy and Sell Stock series (LC 121, 122, 123, 188, 309) — the canonical state machine DP. States: holding, not holding, cooldown. Transitions model allowed actions. LC 123 (at most 2 transactions) and LC 188 (at most k transactions) are frequently asked at FAANG. These teach you to think of DP as a state machine, which generalizes to many other problems.

Frequently Asked Questions

Which dynamic programming problems are asked most in FAANG interviews?
The most frequently asked DP problems at FAANG companies: Coin Change (LC 322), Longest Common Subsequence (LC 1143), Edit Distance (LC 72), Partition Equal Subset Sum (LC 416), Word Break (LC 139), Best Time to Buy and Sell Stock III (LC 123), Burst Balloons (LC 312), and Longest Increasing Subsequence (LC 300). Google asks Edit Distance and Burst Balloons particularly often.
How do I start learning dynamic programming from scratch?
Start with Fibonacci and Climbing Stairs to understand memoization. Then do House Robber (skip-or-take pattern). Then Coin Change (unbounded knapsack). Then Longest Common Subsequence (2D DP). In that order, each problem builds on the previous. Do not start with hard problems — the pattern clarity in easy and medium problems is what builds the intuition.
What is the knapsack problem and why does it matter?
The 0/1 knapsack problem is: given items with weights and values, pick items to maximize value without exceeding a weight limit, where each item can be used at most once. It is the archetype for a large class of interview DP problems. Partition Equal Subset Sum, Target Sum, and Last Stone Weight II are all disguised knapsack problems. Once you recognize the knapsack template, these "hard" problems become routine.
What is the time complexity of dynamic programming solutions?
DP time complexity is typically O(n × m) where n and m are the dimensions of the state space. For 1D DP problems: O(n) time and O(n) space, often reducible to O(1) space. For 2D DP (like LCS or Edit Distance): O(n × m) time and space, often reducible to O(min(n,m)) space with a rolling array.

Practice this pattern

See all problems and the code template →

Study pattern

Syed Peera Saheb

Software Engineer · 5+ years · ServiceNow

Software engineer with hands-on experience passing technical interviews at top tech companies. Built Coding Prep Guide to share the pattern-first prep strategy that actually works. Writes about DSA, system design, and interview strategy.

Buy me a coffee