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.
You're correct - the solution only works with these specific bills as they are multiples of 25. The problem you mention is tougher. It's a good observation and something for me to think about. Thanks!
Except that it's not a general algorithm. It still needs extra logic. Consider another situation where the ticket price in $20 and we have bills worth 10, 20, 50, and 100. When giving change for $100, one solution is to give back 4 $20 bills. But this algorithm can miss such a solution by giving $50 first and then realizing it doesn't have enough $10 bills to complete the transaction.
This comment is hidden because it contains spoiler information about the solution
Brilliant! I love how you simply implemented a general algorithm for calculating the change rather than having a specialised case for every situation (paying with 25, 50 or 100 bill) as 99.9% of the solutions do.