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.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Same
This comment is hidden because it contains spoiler information about the solution
The else if() clause is broken and unnecessary.
It's broken, because the two options aren't mutually exclusive. (for example, consider [1,2,3]. array[i] * array[i-1] is 2 * 1 = 2, which is higher than maxProduct (initialized to 0). But than array[i] * array[I+1] is 2 * 3 = 6, which is higher than maxProduct --- except we never do that check, because of the else.
But it's unnecessary, because right after than, we increment i, so the array[i] * array[i-1] is 3 * 2= 6, so we do it anyway. (or we do it again, if we take the else path)
This comment is hidden because it contains spoiler information about the solution