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.
Looks good to me. Thanks everyone! :) Marking as resolved.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Because the description of the problem describes the array argument as being potentially very large, iterating over the array manually like in this solution is preferred because it will take advantage of short circuiting out of the iteration.
If you use [].forEach, [].filter, [].reduce, etc., then you'll be iterating over potentially millions of numbers when you could have potentially returned after index 2.
Even worse, if you use [].filter or manually populate additional arrays, you'll be doubling the memory used without needing to.
Even worse, you'll encounter the issue of the [].filter/manually-created arrays needing to be resized as they get larger and larger, populating the garbage collector with even more memory without needing to.