class Solution {
public:
    bool IsPopOrder(vector<int> pushV,vector<int> popV) {
        stack<int> assist;
        auto pin1 = pushV.begin();
        auto pin2 = popV.begin();

        while (pin1 != pushV.end()){
            assist.push(*pin1);
            while (!assist.empty() && pin2 != popV.end() && assist.top() == *pin2){
                ++pin2;
                assist.pop();
            }
            ++pin1;
        }

        // 此时压入向量为空
        while (!assist.empty() && pin2 != popV.end() && assist.top() == *pin2){
            ++pin2;
            assist.pop();
        }
        return assist.empty();
    }
};

参考大家的思路使用辅助栈
1、依据压入向量入栈,能出栈的出栈
2、压入向量为空时,依据弹出向量出栈
3、弹出条件不满足时若辅助栈为空则为true