diff options
Diffstat (limited to 'stack_using_queues.cpp')
-rw-r--r-- | stack_using_queues.cpp | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/stack_using_queues.cpp b/stack_using_queues.cpp deleted file mode 100644 index 61e2c88..0000000 --- a/stack_using_queues.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "leetcode.h" - -class MyStack { -public: - queue<int> q; - MyStack() {} - void push(int x) { - int n = q.size(); - q.push(x); - while (n--) { - q.push(q.front()); - q.pop(); - } - } - int pop() { - int ans = top(); - q.pop(); - return ans; - } - int top() { return q.front(); } - bool empty() { return q.empty(); } -}; - -int main() {} |