Caffeinated Coder
Book an appointment
Lesson 22 · Algorithms

Dynamic programming

Some problems ask the same smaller questions over and over. Plain recursion for the 30th Fibonacci number makes over 2.6 million calls, yet there are only 31 different questions. Dynamic programming stores each answer once and reuses it. Watch a table of memory cells fill left to right, first with Fibonacci numbers, then with the fewest coins for each amount.

12 min12 steps5 questionsIntermediate
Fig 22 · Interactive
Loading figure…
or ← →

Quiz Unlocks after the last step.