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.
Omg, such a nice decision, thx for comments it helped me to understand how it works!)
I love this problem
Maybe, the fact that it mutates the original array doesn't make it best practice
Sorry, what's the point of this comment? Why are you claiming the solution isn't feasible while it clearly is (as evident by it having passed all test cases) and telling us to do the auditing instead of giving the measured performance backing your claims? Your code provided in this comment isn't even a good way to benchmark - see Vyacheslav Egorov's presentation on performance and benchmarking to learn more on how performance tests can be useful but are prone to inaccuracy especially when ignoring engine optimizations.
(benchmarked and averaged over 100 unique instances of nodejs)
This code runs faster than even your own code submitted for this kata, which yielded the following benchmarks (also averaged over 100 unique instances of nodejs):
While this solution is easier to implement (which is genius, to be honest), it's not feasible based on time complexity.
You can use this code to compare this function with other implementations for comparison:
I marked this as spoiler for you; please remember to mark code like that in the future ;)
This comment is hidden because it contains spoiler information about the solution
Sorry can someone please explain why (array.pop() || []).reverse()) is used? specifically why is there the '|| []'?
thanks so much
I am confused about this as well
Mutating incoming "array" is considered a bad practice.
Oh god, that is infinitely easier to read than my code i love it. Genius. Good work
Basically, this one has it all and I've never said that before. It's waaay better than mine. The only thing: if line 2 was "var result = [];" you wouldn't need the ternary on line 5, you'd just concat every time.
This comment is hidden because it contains spoiler information about the solution
Ingenious
Man... this is beautiful. Sooo much cleaner and straightforward than my approach. Nice work!
Loading more items...