Ad
  • Custom User Avatar

    I don't think you're right. In order to do what you say, you would have to do at least one check (char == ")") for every character, two checks if the character turns out to actually be ")".
    So your total number of checks would be [number of characters in the string] + [number of ")" in the string]... while in the original solution it was only [number of characters in the string]