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.
This is what i tried to do, but I kept overthinking it and ended up with a much verbose and confusing code. Ill consider this approach in the future!
Observation: though the kata description don't ask for it, it's a good practice to copy the original array and work with it, since the sort method mutate the original array. I like to copy the original with slice method before applying any other method to the array.
This comment is hidden because it contains spoiler information about the solution
I'm learning and I have a question, If 'str' is empty, it returns null and should return []. How does the test pass?
It's a great solution
Mindblowing
https://www.codewars.com/kata/reviews/559595019987562910000014/groups/55a86c703c84d58b2e0000fc is O(n)
Does anyone know the O(n) solution?
What is the O(n) solution?
good idea!!
...in spite of it being patched by the author.
This is amazing
this solution gonna return null if the str is empty, but the expected is[]
This is O(n logn) and it can be solved in O(n)
http://jsbench.github.io/#8deeaa709f814a7c78d502898c99a181
why this is best practice? its 10x slower than substring http://jsbench.github.io/#9cb819bf1ce429575f8535a211f72d5a
Loading more items...