22
测试字符串是否在括号内保持平衡
我们将parens组称为open paren (,与其匹配的close paren )以及其中的所有内容。 如果parens组或字符串不包含任何内容或仅包含2个括号平衡的parens组,则称为括号平衡。 例如: The string "(()())()" is parenthesly balanced ( )() Because it contains exactly 2 parenthesly balanced parens groups ()() The left one is parenthesly balanced because it contains 2 parenthesly balanced parens groups (balanced because they are empty). The right one is parenthesly balanced …