I don't know about this one, somehow @jasterix
solution was more friendly to me. I'm not a fan of RegEx because it's really hard to memorize and easy to forget when you are not using it for a week or so (exaggerating)
Luckily (or sometimes badly), everyone finds something different easier to read. I personally like the RegEx approach more, since it directly show what happens to which parts. I am quite used to read RegEx and find it more confusing to think again about what function is doing what and resulting in what.
Passionate about building great technology and connecting with people to create positive change. Happy to answer questions about transitioning to tech. Find me on Twitter @lounecl
Here is my solution in JavaScript :)
I don't know about this one, somehow @jasterix solution was more friendly to me. I'm not a fan of RegEx because it's really hard to memorize and easy to forget when you are not using it for a week or so (exaggerating)
Luckily (or sometimes badly), everyone finds something different easier to read. I personally like the RegEx approach more, since it directly show what happens to which parts. I am quite used to read RegEx and find it more confusing to think again about what function is doing what and resulting in what.
Very nice! Unfortunately I suck at RegEx :(
Would the Big-O of this be constant?
This one should be O(n). I had the same question in mind and googled it. Never the less, I am actually a big fan of regex :D I have fun writing them.