class Solution {
public:
bool isPopOrder(vector<int> pushV,vector<int> popV) {
if(pushV.size()!=popV.size())return false;
stack<int>tmp;
int i = 0;
for(auto t:pushV){
tmp.push(t);
while(!tmp.empty()){
if(tmp.top()==popV[i]){
i++;
tmp.pop();
}else break;
}
}
if(!tmp.empty())return false;
else return true;
}
};