Build the answer bottom-up by reusing smaller subproblems.
Amount
11
dp[11]
∞
Coins
Legend
Computing dp[a]
Subproblem reused
Solved
AI Tutor Workspace
—
In a nutshell
Dynamic programming takes recursion's habit of redoing the same small problems and fixes it: solve each subproblem just once and save its answer in a table to reuse. Filling the table from the smallest cases upward, the coin-change problem finds the fewest coins for an amount in time proportional to the amount times the number of coin types.
Ready
Press play to begin the cinematic walkthrough.
Solve each subproblem once, store it in a table, and reuse it — turning exponential recursion into a linear scan.