Skip to main content

DP Foundations 21-Day

Name the recurrence before you write code, recognize 1D vs 2D state, and ship a memoized solution inside the interview clock.

By Alex Chen, Founder, InterviewChamp.AI · 21 problems · ~32h · difficulty: mixed · Last verified

  1. Day 1Fibonacci Number(dp-1d)

    DP gateway. Practice the three-line ritual out loud: state, transition, base. Every harder problem starts with this template.

  2. Day 2Climbing Stairs(dynamic-programming)

    Fibonacci with a story. The recurrence f(n) = f(n-1) + f(n-2) is the same — say it before you reach for code.

  3. First problem where the transition takes a min(). Drill the 'cost to STAND on i vs cost to LEAVE i' framing — interviewers test that distinction.

  4. Three-term recurrence. Use it to warm up rolling-array space optimization: 3 vars, no array needed.

  5. Day 5House Robber(dynamic-programming)

    Decision DP: rob this house or skip it. The 'two choices per state' pattern unlocks 30+ problems.

  6. Day 6House Robber II(dp-1d)

    Same DP, run twice on different windows to handle the circular constraint. Name the trick: 'split the problem to remove the wraparound'.

  7. Day 7Maximum Product Subarray(dynamic-programming)

    Carry TWO states (max and min) because negative times negative flips. The first problem where 'one state is not enough' bites.

  8. Day 8Maximum Subarray(dp-1d)

    Kadane's algorithm in DP framing. dp[i] = max(nums[i], dp[i-1] + nums[i]). Say the reset condition out loud.

  9. Day 9Jump Game(dp-1d)

    Greedy beats DP here — track farthest reach. But you must know the DP solution exists to defend the greedy in the interview.

  10. Day 10Jump Game II(dp-1d)

    BFS-flavored greedy: each 'level' is one jump's reach. The shape generalizes to minimum-steps-to-reach problems.

  11. Day 11Coin Change(dynamic-programming)

    Unbounded knapsack in disguise. Drill the inner loop direction — coins outer, amount inner — and explain why.

  12. Day 12Word Break(dynamic-programming)

    1D DP over string prefixes. The state is 'can I segment s[:i]?' — name it before reaching for the substring check.

  13. Day 13Decode Ways(dynamic-programming)

    Counting DP with edge cases. The '0' character is the entire interview signal — handle it explicitly in your transition.

  14. Day 14Longest Increasing Subsequence(dynamic-programming)

    O(n^2) DP first, then patience-sort O(n log n). Know both. The trade is a classic follow-up.

  15. 0/1 knapsack reframe: target = total/2. The transformation step is the interview signal — articulate it before coding.

  16. Day 16Unique Paths II(dp-2d)

    Grid DP with obstacles. The base-row initialization is where most candidates fumble — write it before the main loop.

  17. Day 17Minimum Path Sum(dp-2d)

    Classic grid DP. dp[i][j] = grid[i][j] + min(dp[i-1][j], dp[i][j-1]). Template for every 'walk the grid' DP you'll see.

  18. Day 18Maximal Square(dp-2d)

    2D DP where the state is 'largest square ending HERE'. The min(three neighbors) + 1 transition is the whole problem — burn it in.

  19. Day 19Longest Common Subsequence(dynamic-programming)

    2D string DP. dp[i][j] = LCS of prefixes. Every string-DP problem (edit-distance, regex, wildcard) is a variant of this.

  20. Day 20Edit Distance(dynamic-programming)

    Three operations = three transitions: insert, delete, replace. Master the recursion tree before optimizing — interviewers ask 'why three?'

  21. Capstone. 2D DP on intervals. You should now narrate state, transition, base, and answer-cell in under a minute.

Ready to drill these live?

Get the AI copilot in your ear during real interviews. Real-time transcription. Streaming answers. Post-call scorecard.

Download the desktop app →