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.
The problem has a tag "regex", hence finding a regex solution might be the better solution
It mutates the original array, though, be careful.
Even though this solution traverses the entire array twice, I still think it is clever because it is so idiomatic. Nice job.
Honestly, this solution would have been more readable if the return statement had been split into three different lines. Saving lines of code at the expense of readability doesnt make a solution clever.
@Firefly2002 you definitely had the best, more performant and readable solution. I learned a lot from it. Thanks.
Is it always the case that a for loop is more performant than a reduce that does the same thing?
This is imho the best solution.
This comment is hidden because it contains spoiler information about the solution
Instructions regarding how to deal with spaces in between words were confusion. This alone caused me to waste twenty minutes. Reading back, I can see what the author intended, but this could have been made much clearer.
I prefer this solution for readability compared to the other top solutions.
Nice. I didn't know about the Array.reverse method. I have always been writing my own reversing function. Super useful to know.
I found this solution to be the most readable and easily understandable solution. +1 for best practices.