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.
Классный код! Каждый элемент взаимосвязан. Очень умное использование цикла while и метода reduce.
I love this code, though it took me awhile to understand it completely.
Very neat implementation of recursion.
The value 10 is the last elemnt in the array (the client with the most items).
As he (the last client) would come to the window last, it would take him 10 seconds to process his items and plus 2 seconds from the previous client.
Why do the results have to be 10 or 12?
In both the cases first two clients would occupy both the windows, thus adding 2 seconds or 6 seconds respectively.
When both the clients are finished, the last client would start, adding 10 more seconds.
Thus, the result would be 12 or 16 seconds respectively.
If you pass 0.5 to the function, it won't return the negative value;
This code returns -0, if you pass 0 as a parameter.