AlgoMaster Logo

Implement Queue using Stacks

operations=[push(1), push(2), push(3), pop(), peek(), push(4), pop()]
0 / 31
push(1)push(2)push(3)pop()peek()push(4)pop()inputpushes land hereoutputpops served heretransfer
algomaster.io
Step:Two stacks make a queue: input collects pushes, output serves them in FIFO order