@@ -0,0 +1,1103 @@
+/**%0A * Problem: https://leetcode.com/problems/implement-stack-using-queues/%0A *%0A */%0A%0Aimport java.util.*;%0A%0Aclass MyStack %7B%0A    Queue%3CInteger%3E queue1 = new LinkedList%3CInteger%3E();%0A    Queue%3CInteger%3E queue2 = new LinkedList%3CInteger%3E();%0A    %0A    // Push element x onto stack.%0A    public void push(int x) %7B%0A        queue1.add(x);%0A    %7D%0A%0A    // Removes the element on top of the stack.%0A    public void pop() %7B%0A        while(!queue1.isEmpty()) %7B%0A            int x = queue1.poll();%0A            if(!queue1.isEmpty()) %7B%0A                queue2.add(x);%0A            %7D%0A        %7D%0A        while(!queue2.isEmpty()) %7B%0A            queue1.add(queue2.poll());%0A        %7D%0A    %7D%0A%0A    // Get the top element.%0A    public int top() %7B%0A        int x = queue1.poll();%0A        while(!queue1.isEmpty()) %7B%0A            queue2.add(x);%0A            x = queue1.poll();%0A        %7D%0A        while(!queue2.isEmpty()) %7B%0A            queue1.add(queue2.poll());%0A        %7D%0A        queue1.add(x);%0A        return x;%0A    %7D%0A%0A    // Return whether the stack is empty.%0A    public boolean empty() %7B%0A        return queue1.isEmpty() && queue2.isEmpty();%0A    %7D%0A%7D%0A

Create Implement_Stack_using_Queues.java