by hakfoo · 5y ago · 0 comments
More relevant to this community, it always made me think about the abstract math of change making algorithms.
With the coin denominations we have in the US, the optimal (fewest number of coins) change can always be made by going for the largest coin available less than the remaining balance due. It's entirely possible to make a currency system that was not the case.
As a trivial example:
In a hypothetical system with coins denominated 20, 15, 10, 3, 2, and 1 (basically the Soviet-era model without the 5-kopeck coin) the optimal way to make 25 units (15+10) is not the "largest first" way (20+3+2)
No comments yet.