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 problem of this code is big integers. When one uses them, the code works for too long and we get java.lang.OutOfMemoryError. When one uses for example Integer.MAX_VALUE/10, we already get java.lang.OutOfMemoryError, not to mention Integer.MAX_VALUE.
If arr.length == 0, then java.lang.ArrayIndexOutOfBoundsException, though 0 needed.
If arr.length == 1, then return -1, though 0 needed.