摘要: 搬个官方题解 class Solution { bool valid(const string& str) {//验证是否合法 int balance = 0; for (char c : str) { if (c == '(') { ++balance; } else { --balance; } 阅读全文