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.
Very good!
two for loops has a time complexity of O(n^2), while this approach only takes O(n).
I've tested the two approaches with 10000 numbers and the 2 loop approach was 65 ms, this one was 8 ms, so 8x faster. I've done it with an object, which is just as fast as a map in this case.
Would two for loops not have been faster?
Yay close to mine <3
This comment is hidden because it contains spoiler information about the solution
better solution then double for-loop. More efficient!
Eval is evil when you don't have control of what could possibly be the input. But for this case it is the go to solution.
hey leetcoder
wow, this is some neat stuff you've got in there
This comment is hidden because it contains spoiler information about the solution
what is this sorcery?!
Thanks, the ternary at the return statement actually makes it pretty clean.
...nani?!?!?! >.<