Neo. The Only. The One.
THE ONE
It doesn't look like it properly accounts for ordering. It looks like it would take )( as valid because both halves are there, but it's invalid because of the ordering.
You didn't specifically state ordering so that's why I didn't worry about it
Heres a coding problem that doesnt require a data structure. Just string manipulation.
Return a version of the given string, where for every star (*) in the string the star and the chars immediately to its left and right are gone.
So "ab*cd" yields "ad"
and "ab**cd" also yields "ad".
example outputs:
starOut("ab*cd") → "ad"
starOut("ab**cd") → "ad"
starOut("sm*eilly") → "silly"
I will try this one between tonight and tomorrow.