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.
If you slice sequences by specifying out of bound index, it will slice the sequence to nearest index
How come this doesn't raise an IndexError ("list index out of bounds") in Python, as soon as i reaches len(arr)?
I did not know you could slice arrays with indices larger than the array length...
I was trying to figure out how this one worked, since the array indexes seem off - but it's just adding the "middle" number (
arr[i]
) to both the left and the rightsum()
(which refer to the right and the left halves ofarr
, respectively).