nmoneys icon indicating copy to clipboard operation
nmoneys copied to clipboard

Finite denominations when making optimal change

Open dgg opened this issue 7 years ago • 0 comments

MakeOptimalChange() works under the premise that the set of denominations that is passed is infinite, that is, we never "run out" of pieces for each denomination.

In the real-world, there is only a finite amount of pieces of each denomination. Change the algorithm (and change Denomination as well) or create another method (taking, for instance a collection of FiniteDenominations) to support this real-world scenario.

dgg avatar Jun 15 '17 11:06 dgg