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.
@voyxxx Did you mean 'fewer'?
It might depend on the regular expression engine, but I'd imagine a fixed-width look-around can be optimized to some extent; and I think I've run into it where engines don't support variable-width look-around. Only engine I've really looked at code for is Python's and all the goto statements in there make it pretty hard to follow. What I learned there is that you can avoid regular expression DOS with system interrupts using Python's regular expression engine.
@voyxxx, What do you mean? This algorithm traverses the array less then 2 times. Is that to much?
But it's so easy to read.
nice thank you for the tip @voyxxx!
You but it is hardcore the solution
do you mean this part
(0*)
of the regex?, he/she is grouping here the part w/ zeros, I think it's clever, in a good sense, don't you think so?, or am I missing something?the more times you go through the array, the better the practice
Splice doesn't work the way you think it does. Your solution actually uses quadratically more memory allocations than this solution does. For that reason, splice is also the slowest array method in the language, making your solution quadratically slower.
Even in lower-level languages, arrays usually occupy a continuous chunk of memory addressed via offset, so there is no pointer to reassign, so splice can't be fast. Linked lists have that advantage, but also have distinct disadvantages (mainly slow data retrieval).
I'm glad that you take the time to read others' solutions. With a good attitude and a desire to improve, you'll come up with some great solutions to other kata.
JazzaScript
Hi there! i am not trying to solve the problem in less code lines. My main focus is to model the components of the game in OOP and if you try to understand it, you will.
This comment is hidden because it contains spoiler information about the solution
Please, use spoiler flag. Your post was visible in the home page.