Algorithm · Meta · Easy
Given a string made up exclusively of '(' and ')', determine the fewest parentheses that must be inserted so that the full string becomes balanced. A balanced string has a matching closing parenthesis for each opening parenthesis. Input One string whose characters are limited to '(' and ')' Output Return an integer equal to the minimum count of parentheses that need to be added Example Input Output Input Output Input Output Constraints The string can contain at most 10⁵…