Lesson 01 of 05 · about 4 min

Count the coins

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5

Dynamic programming stores the best answer for every smaller amount and reuses it. For coins, the cell for an amount is one plus the best cell you can reach by paying with one coin.

The till holds pennies, nickels, and dimes. Enter the fewest coins that make 12 cents.

On the Knowledge page

Resources