leetcode-有效的括号

https://leetcode-cn.com/problems/valid-parentheses/description/

class Solution
{
public:
    bool isValid(string s)
    {
        stack ss;
        //char stack[1000];
        //int top = 0;
        int len = s.length();
        int flag = 1;
        int i = 0;
        while(i

因为有pop()操作,所以需要先判断栈是否空

你可能感兴趣的:(leetcode-有效的括号)