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.
Dang. I always forget about using the spread operator to make a shallow copy of an array. Good job.
Thank you for your fast reply :)
I'm still learning about how to recognize and subsequently reduce complexity.
see message above.
This comment is hidden because it contains spoiler information about the solution
Thank you =D
Best solution I seen, good work!
Based
Very true!
sort mutates the original array so spreading here creates a new reference and avoids mutation. Not necessary in the exercise, true, but still worth using in a real application
[...arr]
no need for this spread lol.arr
is already an arrayagree ;)
@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.Good answer, but the formatting needs some work. The variable names should be descriptive, and the return value should get its own line.
I like the clever use of the or statement to catch the out of bounds indexing of the array. I made a slice instead, but I suspect your solution is faster. Nice one!
Loading more items...