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.
It's always big dollar bill first, because if you give smaller dollar bills first at any point you'll always have potential oppotunity to run out of change for cases you can avoid getting into that situation.
Try thinking of a few scenarios and work it out in your head (or by pen and paper) ;-)
It's common sense in this kind of problems (even in real life), you'll always try to get rid of the higher value bills first, to not run out of the small ones.
This comment is hidden because it contains spoiler information about the solution
Breaking bills is not something you can do anywhere, it's implicit.
If it were possible, the problem would be trivial and you could always give them their change (given there is enough in the cash register).
For this test cases fail:
test.assert_equals(tickets([25, 25, 50]), "YES")
test.assert_equals(tickets([25, 100]), "NO")
test.assert_equals(tickets([25, 25, 50, 100, 25, 25]), "YES")
test.assert_equals(tickets([25, 25, 50, 100, 25, 50]), "YES")
test.assert_equals(tickets([25, 25, 25, 25, 25, 25,25,25,25,25,25,25,100,100,100,100]), "YES")
test.assert_equals(tickets([25, 25, 25, 25, 25, 25,25,25,25,25,25,100,100,100,100]), "NO")
test.assert_equals(tickets([100,100,100,100, 25, 25, 25, 25, 25, 25,25,25,25,25,25,25]), "YES")
test.assert_equals(tickets([100,100,100, 25, 25, 25, 25, 25, 25,25,25,25,25,25,100]), "NO")
test.assert_equals(tickets([25, 25, 25, 25, 25, 25,25,25,25,25,25,25,50,50,50,50]), "YES")
test.assert_equals(tickets([25, 25, 25, 25, 25, 25,25,25,25,25,25,50,50,50,50,100]), "YES")
test.assert_equals(tickets([25, 25, 50]), "YES")
test.assert_equals(tickets([25, 100]), "NO")
test.assert_equals(tickets([25, 25, 25, 25, 25, 25, 25, 25, 25, 25]), "YES")
test.assert_equals(tickets([50, 50, 50, 50, 50, 50, 50, 50, 50, 50]), "NO")
test.assert_equals(tickets([100, 100, 100, 100, 100, 100, 100, 100, 100, 100]), "NO")
test.assert_equals(tickets([25, 25, 25, 25, 50, 100, 50]), "YES")
test.assert_equals(tickets([50, 100,100]), "NO")
test.assert_equals(tickets([25, 25, 100]), "NO")
test.assert_equals(tickets([25, 25, 25, 25, 25, 25, 25, 50, 50, 50, 100, 100, 100, 100]), "NO")
test.assert_equals(tickets([25, 25, 50, 50, 100]), "NO")
test.assert_equals(tickets([25, 50, 50]), "NO")
test.assert_equals(tickets([25, 25, 25, 100]), "YES")
test.assert_equals(tickets([25, 50, 25, 100]), "YES")
test.assert_equals(tickets([25, 25, 25, 25, 25, 100, 100]), "NO")
Supposily in the last one, but if i put the last one alone it does not fail
Nice!