Minimum Insertions to Balance a Parentheses String

Solution Code

Time Complexity

O(n)

Space Complexity

O(1)