Skip to content

Coin change

planning ahead

Level 2 of 3

Also called Change-making problem and Fewest coins, by dynamic programming.

fresh numbers

The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from coin change's own run on the numbers shown.

choose one

question 1

How many tries does the method make on coins of 1, 6 and 7 paying 7?

the answer, and why

the answer is B

Coin 1 is tried at 7 amounts, coin 6 at 2 and coin 7 at 1, which is 10.

if you chose another

  • That tries every coin at every amount, but coins 6 and 7 are too big for the first amounts.
  • That is the number of amounts filled, not the tries.
  • That is the fewest coins for 7, as 7.

new numbersthe test page's numbers

question 2

Coins of 1, 3 and 4 pay 6. What is the fewest number of coins?

the answer, and why

the answer is C

The fewest is 3, 3, 2 coins. No 1 of these coins add to 6.

if you chose another

  • That is biggest coin first, 4, 1, 1.
  • No 1 of these coins add to 6.
  • That pays in coins of 1 only.

new numbersthe test page's numbers