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.
Okay.. so if I used that logic: how do i answer [25, 25, 50, 100] = true ?
To explain in detail, these were the two encounters I tried to go with:
e.g. Clerk has 50, customer gives 100: Clerk has enough change because (remainder of 50 + ticket of 25) = 75
e.g. Clerk has 50, customer gives 100: Clerk does not have enough of change because customer needs 75 and clerk CURRENTLY only has 50
"Should return false for {25, 25, 100}"
I don't quite get this, because the clerk would've had 50 by the time it reached the 3rd person in line. If the clerk sold a ticket to that person, the clerk would've had enough of change at 75 which is needed by the customer.
I used this logic because it applied to other test cases, or the other cases would've failed.
Test given: [25, 25, 25, 25, 50, 100, 50], to return True; However this is not the case because after accumulating the first four customer's money, the toal adds up to 100, leaving a 25 change for the next customer who pays 50, the total becomes 75; leaving a 75 change for the next customer who pays 100, the total becomes 0; the clerk does not have enough change for the next customer who pays 50.