Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
( JS )
Example tests:
it("123 is 25+25+25+25+10+10+1+1", () => {
is missing one+ 1
.There may be more.
The task stated by the kata is
It didn't tell us to calculate the amount of coins as determined by a greedy algorithm. In fact both are incompatible, since a greedy algorithm is not a correct algorithm. So the description at it is right now is unacceptable.
The kata only guarantees that "all amounts given will be solvable" and "a greedy algorithm should be used", but does not guarantee that the solution can be reached via a greedy algorithm, e.g:
9
and[5,3]
.I have attempted to translate to Ruby
Requiring the solution to handle unsorted denominations seems silly.
why?
There is something strangely back-to-front with this Kata because the premise of it is that "No one enjoys carrying around spare change", and yet the requirement of the Kata is to try to pay for something using the minimum number of coins.
IMO if you don't like carrying coins then you should be trying to get rid of the maximum number of them! ;-)