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.
Cool! But what about complexity of your algorithm? Instead of O(n), you seems to have O(n*log(n)).
I like the solution provided by jakalm, but you are right and your comment about range is reasonable. The approximation starts failing somewhere in range 8e8 < beer_count < 9e8.
There are specifications:
So a (silly and absurd) input of a negative queue will never happen.
Very nice! However, it will crash when (n <= 0).