@@ -0,0 +1,1010 @@
+package com.anuragkapur.leetcode;%0A%0Aimport java.util.Deque;%0Aimport java.util.LinkedList;%0A%0A/**%0A * Implements a stack using a queue.%0A * Problem #225, https://leetcode.com/problems/implement-stack-using-queues/%0A * %0A * @author anuragkapur%0A */%0Aclass MyStack %7B%0A%0A    private Deque%3CInteger%3E deque;%0A%0A    public MyStack() %7B%0A        deque = new LinkedList%3C%3E();%0A    %7D%0A%0A    // Push element x onto stack.%0A    public void push(int x) %7B%0A        Deque%3CInteger%3E temp = new LinkedList%3C%3E();%0A        temp.addLast(x);%0A        while(!deque.isEmpty()) %7B%0A            temp.addLast(deque.removeFirst());%0A        %7D%0A        deque = temp;%0A    %7D%0A%0A    // Removes the element on top of the stack.%0A    public void pop() %7B%0A        if(!deque.isEmpty())%0A            deque.removeFirst();%0A    %7D%0A%0A    // Get the top element.%0A    public int top() %7B%0A        if(!deque.isEmpty())%0A            return deque.getFirst();%0A        return -1;%0A    %7D%0A%0A    // Return whether the stack is empty.%0A    public boolean empty() %7B%0A        return deque.isEmpty();%0A    %7D%0A%7D%0A

Add problem #225 solution