【剑指offer】题22:栈的压入、弹出序列
2017-07-02 11:05
387 查看
class Solution { public: bool IsPopOrder(vector<int> pushV, vector<int> popV) { if (pushV.size()==0||popV.size()==0||pushV.size()!=popV.size()) { return false; } stack<int> my_stack; int index(0); for (auto i = 0; i < pushV.size();++i) { my_stack.push(pushV[i]); while (my_stack.size()>0&&my_stack.top()==popV[index]) { my_stack.pop(); index++; } } if (my_stack.size()==0) { return true; } else { return false; } } };
相关文章推荐
- 剑指offer 面试题22 栈的压入弹出序列
- 剑指offer——面试题22:栈的压入和弹出序列
- 剑指offer 面试题22:栈的压入、弹出序列 题解
- 剑指offer-22:栈的压入弹出序列
- 剑指offer--面试题22:栈的压入、弹出序列
- 剑指Offer面试题22(Java版):栈的压入、弹出序列
- [剑指offer]面试题22:栈的压入、弹出序列
- 剑指 offer面试题22 栈的压入和弹出序列
- 剑指offer-面试题22-栈的压入、弹出序列
- 剑指offer面试题22:栈的压入、弹出序列
- 【剑指offer】面试题22:栈的压入弹出序列
- 剑指offer-面试题22:栈的压入,弹出序列
- 剑指offer——面试题22:栈的压入、弹出序列
- 剑指Offer 22 栈的压入,弹出序列
- 剑指Offer:面试题22——栈的压入,弹出序列(java实现)
- 【剑指Offer】面试题22:栈的压入,弹出序列
- 剑指offer22--栈的压入弹出序列
- 剑指offer面试题22 栈的压入、弹出序列
- 【剑指offer】4.3举例让抽象问题具体化——面试题22:栈的压入、弹出序列
- 剑指offer 22 栈的压入、弹出序列