Minimum Insertions to Balance a Parentheses String
Each open bracket needs two close brackets, so track open brackets and insert whatever is missing as you scan.
Each open bracket needs two close brackets, so track open brackets and insert whatever is missing as you scan.