dimanche 3 avril 2016

Coin backtrace Dynamic Programming C++

How can I perform a backtrace of the completed memo table and generate a report that gives the number of each coin denomination used?

output:

Using denominations [1, 6, 10]

The optimal number of coins for 25 is 5

Coins used:

1: 1

6: 4

10: 0

Aucun commentaire:

Enregistrer un commentaire