Skip to content

Commit

Permalink
[232. Implement Queue using Stacks][]committed by LeetCode Extension
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicksxs committed Sep 14, 2016
1 parent 60dff23 commit 904706b
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions 232-Implement-Queue-using-Stacks/Question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 232. Implement Queue using Stacks

[Original Page](https://leetcode.com/problems/implement-queue-using-stacks/)

Implement the following operations of a queue using stacks.

* push(x) -- Push element x to the back of queue.
* pop() -- Removes the element from in front of queue.
* peek() -- Get the front element.
* empty() -- Return whether the queue is empty.

**Notes:**

* You must use _only_ standard operations of a stack -- which means only `push to top`, `peek/pop from top`, `size`, and `is empty` operations are valid.
* Depending on your language, stack may not be supported natively. You may simulate a stack by using a list or deque (double-ended queue), as long as you use only standard operations of a stack.
* You may assume that all operations are valid (for example, no pop or peek operations will be called on an empty queue).

<div>

[Subscribe](/subscribe/) to see which companies asked this question

</div>

<div>

<div id="company_tags" class="btn btn-xs btn-warning">Show Company Tags</div>

<span class="hidebutton">[Bloomberg](/company/bloomberg/) [Microsoft](/company/microsoft/)</span></div>

<div>

<div id="tags" class="btn btn-xs btn-warning">Show Tags</div>

<span class="hidebutton">[Stack](/tag/stack/) [Design](/tag/design/)</span></div>

<div>

<div id="similar" class="btn btn-xs btn-warning">Show Similar Problems</div>

<span class="hidebutton">[(E) Implement Stack using Queues](/problems/implement-stack-using-queues/)</span></div>

0 comments on commit 904706b

Please sign in to comment.