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.
Your solution inspired me to learn more about Regex.
Well done.
very effective solution)
Wow.
cool! match vs split
This is the most unique and best solution. It's a pity that I could not think of this) Thanks
It has been said, "The blues live in the notes you don't play"
Remember not only to say the right thing in the right place, but far more difficult still, to leave unsaid the wrong thing at the tempting moment.
Don't say much, do ya? ;)
Since nobody has pointed it out yet: this is O(n^2), which is not great. Every time it runs replace it has to read in the entire string, and it has to do this an amount of times that is in worst-case proportionate to the entire string. For example, if my string is ['NORTH', 'WEST', 'NORTH', 'SOUTH', 'EAST', 'SOUTH'] or a similar construction, I can only remove one pair at a time. So for a string with N pairs, I have to read N times, and the lengths each time are (N), (N-1), (N-2), etc.
It is however clever as hell. Behold the power of regex.
This is awesome. Every time I submit there's something like this that inspires me to keep learning.
I like this solution... again shows the power of regex... wish I understood it better!
Amazing! Short and clean. But if you add the global flag (g) to the pattern's end you get less iterations, so more eficient code. Good job though!
That's a very nice solution.