首页 > TAG信息列表 > Insertions
LeetCode 1541. Minimum Insertions to Balance a Parentheses String
原题链接在这里:https://leetcode.com/problems/minimum-insertions-to-balance-a-parentheses-string/ 题目: Given a parentheses string s containing only the characters '(' and ')'. A parentheses string is balanced if: Any left parenthesis '(1541. Minimum Insertions to Balance a Parentheses String
Parentheses的题,首先想到stack,思路如下: 1. If get a left parentheses, if the stack size is odd number, that means, one right parentheses is missing, so result plus one, and pop the missing right parentheses. And then, push two right parentheses to stack, that m