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 reference solution was wrong, it was then fixed.
The assert answer is not right! No way that -61 is in between -66 and -96! Please correct it.
This will incorrectly return 0 if
arr[0]
happens to be 0:What you wanted to do was check that
arr
isn't empty, to avoidreduce
throwing an error. You could usearr.length
to determine that it's not empty. However, if you just seedreduce
with an initial value, then it can process an array of length 0, so you won't need to check the array's length at all.