Given a parentheses string s containing only the characters '(' and ')'.
A parentheses string is considered balanced when:
Every open parenthesis '(' is matched with exactly '))'.
Every open parenthesis '(' occurs prior to its corresponding pair of closing parentheses '))'.
You may insert characters '(' or ')' at any position within the string.
Return the minimum number of insertions required to make s balanced.
Constraints:
s.length
s consists of '(' and ')' only.
Given a parentheses string s containing only the characters '(' and ')'.
A parentheses string is considered balanced when:
Every open parenthesis '(' is matched with exactly '))'.
Every open parenthesis '(' occurs prior to its corresponding pair of closing parentheses '))'.
You may insert characters '(' or ')' at any position within the string.
Return the minimum number of insertions required to make s balanced.
Constraints:
s.length
s consists of '(' and ')' only.