1 class Solution{ 2 public: 3 bool IsPopOrder(vector<int> pushV,vector<int> popV){ 4 if(pushV.size()==0) return false; 5 vector<int> stack; 6 for(int i=0,j=0;i<pushV.size();){ 7 stack.push_back(pushV[i++]); 8 while(j<popV.size()&&stack.back()==popV[j]){ 9 stack.pop_back(); 10 j++; 11 } 12 } 13 return stack.empty(); 14 } 15 };