Loading...
Implement a LIFO stack using only two queues. Support push, pop, top, and empty.
Output results of pop, top, and empty operations.
push,1;push,2;top;pop;empty
2 2 False
push,1 and push,2, resulting in a stack with elements 1 and 2.top operation returns the last element added to the stack, which is 2.pop operation removes the last element added to the stack, which is also 2, leaving the stack with only element 1.empty operation checks if the stack is empty, which it is not, since it still contains element 1, so it returns False.