-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[232. Implement Queue using Stacks][]committed by LeetCode Extension
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |