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.
Fixed.
Yep, I think that any integer returned passes all the tests O.o
As far as I understand the solution, we are trying so find the maximum negative value (m) substracted from the sum of s so far (and m can't be higher than 0), and the max value will be the max between sum of all the elements so far, or sum of the elements without maximum negative value.
But, yes, the solution is quite difficult to visualise.
Great kata! Fell into the "premature optimization" trap before solving this one, so it took a while, but I really enjoyed the problem.
The kata does not seem to work! My suolution was to just return 2, and it passed all tests. So, unless the laws of probability are greatly in my favour there is probably a problem with the tests somewhere...
Simply beautiful! I still can't really visualise how or why this works, but the brevity and efficienty is just amazing!