class Solution { public: bool IsPopOrder(vector<int> pushV, vector<int> popV) { int len = pushV.size(); stack<int> s; int j = 0;//表示进栈元素的个数 for (int i = 0; i < len; i++) { while (j < len && (s.empty() || s.top() != popV[i])) { //刚刚初始化的s执行top()会报错,所以放在or后面,当s为空时不再执行后面的s.top()。...