Relevant Patterns
#Study these pattern guides before tackling the problems. Understanding the core concepts will help you solve them more efficiently.
Practice Problems
#Easy#70
Show 2 hints
- dp[i] = dp[i-1] + dp[i-2]; base cases dp[0]=1, dp[1]=1.
- Space optimize with two variables.
Medium#198
Show 2 hints
- dp[i] = max(dp[i-1], dp[i-2] + nums[i]).
- Track prev and prev2 to get O(1) space.
Medium#300
Show 2 hints
- Classic O(n log n) patience sorting: tails array and binary search.
- Alternatively O(n^2) DP: dp[i]=1+max(dp[j]) for j<i and a[j]<a[i].
Medium#322
Show 2 hints
- Unbounded knapsack: dp[x] = min over coins c (dp[x-c] + 1).
- Initialize dp with INF except dp[0]=0.
Medium#62
Show 2 hints
- Grid DP: dp[i][j] = dp[i-1][j] + dp[i][j-1]; handle obstacles in related problem.
- Space optimize with one row.
Hard#72
Show 2 hints
- 2D DP over prefixes; transitions: insert/delete/replace.
- If chars equal, carry dp[i-1][j-1].
Track Your Progress
Mark problems as complete as you solve them. Come back anytime to continue where you left off.