let tempstr = strarr.slice(i, i+k).join('');
is this not easier rather then making tempArray and tempStr? or am I missing something?
I got it.
This comment is hidden because it contains spoiler information about the solution
Let me have a look :)
Mine is sooooo much more complicated, Duhhh!
Many thanks. Done!
Sleep over it. You can do it
You would better add "minimal" before "number".
return the "minimal" number of parenthesis reversals needed to make balanced parenthesis.
After all,there are several ways to make balanced parenthesis.
Let me have a Look :-)
Use pure functions - no side effects - or, in other words, do not change the input array: it is bad practice and you will not pass the tests that way.
I'd be really grateful if someone could explain this to me. I have (i thought) solved this using recursion and shift and pass all of the initial tests but fail all of the ones saying "it should work for random inputs too". Why should the resulting arrays be full of zeros? I'm fairly new to this so if anyone can provide an insight that would be wonderful!