@@ -0,0 +1,1115 @@
+import java.util.Stack;%0A%0Apublic class MyQueue %7B%0A%0A    private Stack%3CInteger%3E input;%0A    private Stack%3CInteger%3E output;%0A%0A    /** Initialize your data structure here. */%0A    public MyQueue() %7B%0A        input = new Stack%3CInteger%3E();%0A        output = new Stack%3CInteger%3E();%0A    %7D%0A%0A    /** Push element x to the back of queue. */%0A    public void push(int x) %7B%0A        input.push(x);%0A    %7D%0A%0A    /** Removes the element from in front of queue and returns that element. */%0A    public int pop() %7B%0A        peek();%0A        return output.pop();%0A    %7D%0A%0A    /** Get the front element. */%0A    public int peek() %7B%0A%0A        if (output.empty()) %7B%0A%0A            while (!input.empty()) %7B%0A                output.push(input.pop());%0A            %7D%0A%0A        %7D%0A%0A        return output.peek();%0A%0A    %7D%0A%0A    /** Returns whether the queue is empty. */%0A    public boolean empty() %7B%0A        return input.empty() && output.empty();%0A    %7D%0A%0A%7D%0A%0A/**%0A * Your MyQueue object will be instantiated and called as such:%0A * MyQueue obj = new MyQueue();%0A * obj.push(x);%0A * int param_2 = obj.pop();%0A * int param_3 = obj.peek();%0A * boolean param_4 = obj.empty();%0A */%0A

Create : 232 Implement Queue using Stacks