LintCode-剑指Offer-(40)用栈实现队列
来源:互联网 发布:centos 安装不上ibus 编辑:程序博客网 时间:2024/06/01 09:10
class Queue {public:stack<int> stack1; stack<int> stack2; Queue() { // do intialization if necessary } void push(int element) { // write your code here while(stack1.empty()==false){ stack2.push(stack1.top()); stack1.pop(); } stack1.push(element); while(stack2.empty()==false){ stack1.push(stack2.top()); stack2.pop(); }}int pop() { // write your code here int tmp=stack1.top(); stack1.pop(); return tmp;}int top() { // write your code here return stack1.top(); }};
0 0
- LintCode-剑指Offer-(40)用栈实现队列
- lintcode-用栈实现队列-40
- LintCode 40 用栈实现队列
- LintCode之40 用栈实现队列
- Lintcode 用栈实现队列
- LintCode:用栈实现队列
- 【LintCode】用栈实现队列
- LintCode : 用栈实现队列
- lintcode,用栈实现队列
- Lintcode 用栈实现队列
- Lintcode 用栈实现队列
- [剑指offer]用两个栈实现队列
- 【剑指offer】用两个栈实现队列
- 剑指offer--用两个栈实现队列
- 剑指Offer-用两个栈实现队列
- 剑指offer:用两个栈实现队列
- 《剑指offer》用两个栈实现队列
- 用两个栈实现队列(剑指offer)
- java—数组(上)
- Visual Studio 2013中引入Web Service的简单方法
- 【Leetcode】Binary Tree Preorder Traversal
- 输入n个数,分别将这些数从大到小排列输出和从小到大排列输出
- NSURL 中的HTTP 中文乱码
- LintCode-剑指Offer-(40)用栈实现队列
- 基于winpcap的网络mac地址发现
- 优雅的浏览 man 手册页
- Android多Activity简介
- 黑马程序员——Java语言的基础语法总结(上)
- 南大软院大神养成计划--day05
- USB HID调试过程中碰到的一些问题
- windows7_64下Oracle客户端及PL/SQL安装
- 安全测试(1)