Question 845044: I'm having a bit of trouble figuring out the correct algorithm for this problem:
''What collection of pennies, nickels, dimes, and quarters represents the greatest total value of coins that you may have in your pocket and still not be able to make exact change for a dollar bill?''
However, I realized that I don't actually know how to do this myself without examining every possible combination of coins. There has to be a better way of solving this problem, but I don't know what the generic name for this type of algorithm would be called, and I can't figure out a way to simplify it beyond looking at every solution.
I was wondering if anybody could point me in the right direction, or offer up an algorithm that's more efficient.
Answer by richwmiller(17219) (Show Source):
You can put this solution on YOUR website! the highest number would be 99 coins if you just have pennies
99 pennies
74 pennies and one quarter
64 pennies and one quarter and one dime
59 pennies, one quarter, one dime and one nickel.
|
|
|