Java for LeetCode 232 Implement Queue using Stacks
2015-09-23 12:55
459 查看
Stack<Integer> stack=new Stack<Integer>(); public void push(int x) { stack.push(x); } // Removes the element from in front of queue. public void pop() { stack.remove(0); } // Get the front element. public int peek() { return stack.get(0); } // Return whether the queue is empty. public boolean empty() { return stack.isEmpty(); }
相关文章推荐
- 怎么控制UIStoryboardSegue是否进行跳转?
- iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)
- IOS中UIScrollView的contentSize、contentOffset和contentInset属性
- *Unique Binary Search Tree
- 帧动画 连续播放多张图片动画 以及ui动画 SoundPool
- hdu 5136 Yue Fei's Battle 树的dp计数
- CYC- 简单UIView动画
- UIView中的layoutSubviews和drawRect
- iOS开展UI一片—简单的浏览器观看节目
- *Unique paths II
- uGUI 基本组件
- UITapGestureRecognizer 手势传值
- 【Mockplus教程】如何批量导入图片到收藏夹中?
- 【Mockplus教程】创建
- Android入门之UI篇——详解Activity(一)
- 【Mockplus教程】分组
- 从什么是 Bluemix 说起
- SynchronousQueue
- Qt中Ui名字空间以及setupUi函数的原理和实现
- UIActivityIndicatorView的使用