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.
failed even for {25, 50}
This solution is not correct; it is made assuming that the clerk can exchange the receiving 50 and 100$ bills into 25$ bills instantly, which the description clearly states that he can't. It just passes the tests because they don't check for bill amounts, just for the final result. It probably wasn't coded for this, but it cheats the tests. The tests need a revision, and this answer should be removed.
I came up with a VERY similar solution that was just structured differently but could not pass all the tests.
I think I see how jpryciak was able to make it work but I threw out the idea and came up with another solution.
If this works under more extensive testing then I'd be surprised.
What a defalcation!!!
despite of kata, just look at bank:
it is obvious that if three people buy three tickets finally should be 75 dollars in bank...
but in this algorithm after a [25 25 50] sequence we have only 50 dollars in bank, !!!
As what happened in algorithm: 25 + 25 - (50-25) + 25 = 50 !!!
What about 50s given as change to 100s?
This code fails for even the simplest test: [25, 50] => YES
The set of test cases needs fixing on this kata!
25,25,25,100 should return YES, this code returns NO
As UKS notice, this solution should not pass.
If you use the following entry :
int[] peopleInLine = new int[] { 25, 25, 50, 50, 50 };
The correct answer is "NO". When the last person want to pay; we only have 50$ bill; so we are unable to give back 25$
But, when you launch this code; it will answer "YES".
I check this code with the submite button. It really success in passing the test.
I think; it lack some test that will show that this code is failling.
Best solution. But the "continue;" is not needed.
I think it's good .Thinking more,coding less.
This solution must not pass! Looks like author didnt write correct tests for such solutions.
(its using in bank only 25$ money, even if people giving 50$ money or 100$ money)