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.
agree ;)
@JChampt in my opinion, sorting is a bottleneck in your solution
Clever. I didn't think about using hash table for keeping both indexes and watching for a duplicate. I used a
Set
for the latter.That's true, but people still seem to like it ;-)
It works, why don't you test it?
I think this only works if the unique number is one of the first three numbers of the array.
In case of arr=[1,1,1,1,1,2], then arr[:3] is [1,1,1] and the unique is not in it.
<3
Omg never thought of that! You just made this solution so much better, that means we will only iterate through this once!