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.
that's awesome! Thanks RobsonMoon! It turned out, creating a new data structure is the fastests.
true, but, if you sort the numbers, in worst case scenariou you would go only through half of the numbers.
Without sorting in worst case you would have to go through all of them.
Please correct me if I'm wrong
nothing really, the case imply that there is n negative and n positive numbers with just one pair.
thats why optimization is the key
Hey Crisan,
there should be only one pair in the array.
Also what if array has 1000+ ints in it?
hey RobsonMoon,
what you think about sorting it first?
this is a nice one
Nice one mate, looks really clever.
Please check mine, on js banchmark is 86.25% faster. I think it could be even faster if I would compare first and last item in the array