标签:
class Solution { public: bool IsPopOrder(vector<int> pushV,vector<int> popV) { stack<int>tmp; int size = pushV.size(); if(size == 0) return false; for(int i=0,j=0;i<size;){ tmp.push(pushV[i++]); while(j<size && tmp.top() == popV[j]){ j++; tmp.pop(); } } return tmp.empty(); } };
标签:
原文地址:http://www.cnblogs.com/yuguangyuan/p/5935690.html