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)
cool! match vs split
This is the most unique and best solution. It's a pity that I could not think of this) Thanks
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!
Yes! And the author of this Kata made the same mistake.
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!
I like this part so much :
tactic[r1.tactics.shift()]
Bravo!!!
That's a very nice solution.
surely line 7 is wrong? r2 should be r1?
The regex itself is nothing fancy but the fact that he solved this problem with regex shows he's a very big fan of regex.
@Calgiles3 In line 4 array with directions is returned or empty array if no direction is found (instead of null). Hope it helps!
This comment is hidden because it contains spoiler information about the solution
Loading more items...