Community Problem

Min Add to Make Parentheses Valid

Difficulty: Medium

Count the minimum number of '(' and ')' insertions that turn a parenthesis string valid using a single-pass two-counter scan.