Purplle.com interview question

How to implement queue using stack

Interview Answer

Anonymous

14 July 2021

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