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 "else" does nothing in this code. Otherwise, great!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Cheaky ;)
Can't believe this is highest for best practice and clever.
You can do this:
Simply:
O(n) instead of O(n*2)
Clever and best performance by far, but if your average developer has to stop and think too much about how it works, it's probably not a best practice. Yet... this is the highest rated best practice. Why?
This comment is hidden because it contains spoiler information about the solution
There are submissions which fail the description. I've seen a couple that would fail on an array of [-2], just because if there's only 1 element, they return that element. The details clearly state for all negative numbers, return 0. Basically, you cannot return a negative and the tests do not explicitly include an array with only negative results, even though that's explicitly stated in the details.