Open petrjoachim opened 3 years ago
Thank you for your feedback. I got it wrong indeed and didn't covered the least amount of coin returned. I'll have a look tomorrow and get back to you.
Hi @petrjoachim,
I reworked getChange()
and fixed the issue.
I let you have a look, the changes are published to npm.
25de8ab094b98bf456e8873596bc62a035b5491a
In some situations, getChange method doesn't return correct values. An example to this is input
getChange(12, [1, 4, 5])
- it should result in three coins of value 4 which is the least amount of coins, but it returns two 5 coins and two 1 coins.Actual behavior:
Correct behavior: