We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Queue using Two Stacks
Queue using Two Stacks
Sort by
recency
|
507 Discussions
|
Please Login in order to post a comment
Using Python3
Use perl language:
It's a one liner code.
while(<>){(v)=split;v:c==3&&print"$q[0]\n"}
For Java 7.
import java.util.Scanner; import java.util.Stack;
class Queue { Stack getIn = new Stack<>(); Stack getOut = new Stack<>(); int size = 0;
}
public class Solution { public final static Scanner sc = new Scanner(System.in);