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.
there's no need to check n equal 5, 7 & 11 in 2nd if. As it's already covered in for loop iterations.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
very effective solution)
Very nice solution!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
leverage that sig is changing right?
cool! match vs split
This comment is hidden because it contains spoiler information about the solution
This is harmony
This is the most unique and best solution. It's a pity that I could not think of this) Thanks
really neat
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.
Loading more items...