Interactive Course

Dynamic Programming,
Visually.

Stop memorizing patterns. Build the intuition. Every recurrence is animated step-by-step. Watch a DP table fill cell by cell, trace the dependencies, scrub backward to any moment, and rebuild the whole thing with a different input.

What is DP?

Those who cannot remember the past are condemned to repeat it. Dynamic programming is a way to solve a hard problem by breaking it into smaller, overlapping subproblems and solving each of those exactly once, storing the answer in a table so you never recompute it.

The payoff is enormous. A naive recursive Fibonacci makes ~1.5 million calls for n = 30. The DP version does 31 writes. This course shows you that gap, visually, on every lesson.

The Four Questions

Ask these before writing code. They turn DP from a collection of formulas into a repeatable problem-solving process.

1. Define the state

What does one entry mean? Say it in a complete sentence before using symbols. For example: dp[i] is the number of ways to reach stair i.

2. Derive the recurrence

What final decision could produce this state? Turn each possible decision into a smaller subproblem, then combine their answers.

3. Set bases and order

Which smallest states already have known answers? Which dependencies must be solved before each new state can be calculated?

4. Choose the execution

Use memoization to solve needed states top-down, or tabulation to fill them bottom-up. The state, base cases, and recurrence stay the same.

Your checkpoint: explain all four in plain language before you code. If one answer is unclear, the DP design is not finished.

Why this course is different

  • Scrub any direction.

    Step backward through a DP table and every cell, arrow, and code highlight stays consistent. The timeline is reversible by construction, not by special-casing.

  • Change the input, instantly.

    Drag n from 1 to 12 and the trace rebuilds live. See how the table, the dependency graph, and the operation count all scale, not just the final answer.

  • Read the code alongside the table.

    Every animated step highlights the exact line of source it executes. The visualization is the algorithm; there is no hidden logic.

Lessons (Work in Progress)

BeginnerComing Soon

House Robber

1D DP with a choice

Maximize loot without robbing two adjacent houses. Introduces the dp[i] = max(dp[i-1], dp[i-2] + nums[i]) pattern, the backbone of optimization DP.

IntermediateComing Soon

Coin Change

Minimization DP

Fewest coins to make an amount. The canonical min-DP, with the compare step in the trace schema finally getting a workout.

IntermediateComing Soon

Longest Common Subsequence

2D tabulation

The foundational 2D DP. Same player, same timeline builder, and a new emitter. This is exactly the architecture this course is built to scale on.