[Solved] Coin Change Problems [duplicate]


If you want to make change for the number n, set up an array number_of_coins[n] and fill it in from left to right. number_of_coins[0] is 0, obviously. The next few you can do by hand (although once you have an algorithm it will fill them in automatically). To fill in larger entries m in the array, think about this: what if I removed 1 cent from m? Or 3 cents? Or 4 cents? Or 5 cents?

Once you have the number of coins array up to n, you can walk backwards through it to find the exact coins to use.

solved Coin Change Problems [duplicate]