Purplle.com Interview Question

How to implement queue using stack

Interview Answer

Anonymous

Jul 14, 2021

Takes 2 stacks , to enqueue directly push into stack and to dequeue empty complete stack and push into another stack then dequeue.