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.
I wish more people understood this. Lol Especially for beginners, seeing one line of code without anyting meaningful just makes no sense to me.
shorter code != better code
IMHO This is readable but bad performance wise.
IndexOf & lastIndexOf iterate over all elements in the array. Therefore, this will have a quadratic time look-up since the function is looking at a every index in the array 3 times.
Nice, more performant than my answer.
This was how I came up with it too!
Same solution here, but isn't using too many lines?
To be fair, I think this is the most comprehensible solution.
Its just the most simple syntax, most beginners like myself use that
Oh wow, my solution is just like yours.
well done!
nice
Took me a while to get this answer. While it is very clever, I don't see how this is anywhere close to a best practice.
Love it!
You used sort. Not that much faster.
There are simple O(n) solutions. They actually are much faster.