Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and empty).
Implement the MyStack class:
Notes:
At most 100 calls will be made to push, pop, top, and empty.
All the calls to pop and top are valid.
225. Implement Stack using Queues
Easy
10 Points
Stack
Design
Queue
Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and empty).
Implement the MyStack class:
Notes: