Cash Register Challenge - Weak Test Cases

Hi all!

Just finished the JS Certification! Pretty nice way to close it with this problem (perfect for feeling floating point common issues with the language).

Anyway, the purpose for this topic is to notify that test cases are a bit weak, as the problem might be solved with just a classic greedy algorithm (that would be taking the biggest currency possible in every step until reaching the amount asked).

That would be a proper way to answer if each currency is multiple of every smaller one, but not the case here (as we have both QUARTERs and DIMEs).

So, for example, a 0.3 change is not reachable if my CID is [[DIME, 0.3], [QUARTER, 0.25]] and I take the only quarter in a first approach. It’s a fancy example, as it seems pretty obvious to catch in our minds, but it could be crazily different to approach the algorithm for covering it correctly (recursion, dynamic programming,…).

There’s no test to check that behavior at the moment, and it’s worth adding an easy one. I’m pretty sure some people may approach as told above. Kinda sad, as it lose some magic in that way. Just a humble suggestion!

And keep coding!

Thank you for helping make FCC better. Bugs should always be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

Thanks for the info Ariel! I’ll check it later on GitHub and report if necessary.