String
921. Minimum Add to Make Parentheses Valid
Every unmatched bracket costs exactly one insertion, so the whole task is counting two independent kinds of unmatched bracket: a ) that shows up with no open ( waiting for it, and a ( still waiting when the string ends.
Loading…