Given a coin system, with 1 and 0.01, greedily determine the change plan for some given values.
Because we need to use as many larger coin as possible, we first sort the coins in decreasing order. And then, greedily select coins as many as possible.
It will be better if you use integers rather than decimals by multiplying all input values with 100.
AUTHOR’S AND TESTER’S SOLUTIONS:
Author’s solution can be found here.
Tester’s solution can be found here.