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.
The queue you've written is correct, but each clone and the original drinks only one can, so all the "sheldons" together would drink 4 cans.
I am really sorry. The issue was in my solution.
The tests don't use the order, or the specific value, of thread IDs. They just use thread IDs to identify how many threads were used, and which numbers were grouped together in the same thread. The only thing it relies on is that each thread has a unique ID, which is guaranteed.
The tests pass randomly as the order of threads depends on their id which can vary
It's not clear for me what happens on the 3rd cycle? All of them drink 4 cans of cola or they continue drinking 2 cans at once? Is this a correct queue?
Sheldon, Leonard, Penny, Rajesh, Howard,
Sheldon, Sheldon, Leonard, Leonard, Penny, Penny, Rajesh, Rajesh, Howard, Howard,
Sheldon, Sheldon, Sheldon, Sheldon, Leonard, Leonard, Leonard, Leonard, Penny, Penny, Penny, Penny, ...
If I am not mistaken // operator is in Python since 2.2... I found this in PEP 238
Here are the changes 2.2 introduces:
thanks for helping me improve my code! :) does the // mean that python3 is used?
This comment is hidden because it contains spoiler information about the solution