Minimum Add To Make Parentheses Valid
medium
1: Given a string S of '(' and ')' parentheses. 2: You need to find count of minimum number of parentheses '(' or ')' when added in any positions so that the resulting parentheses string is valid.
Constraints
1: S.length <= 1000 2: S only consists of '(' and ')' characters.
Format
Input
Input is managed for you
Output
Output is managed for you
Example
Sample Input
()))((
Sample Output
4
Question Video