Klarna Interview Question

How can you implement a queue with just a stack?

Interview Answer

Anonymous

Oct 6, 2015

using two stacks. while Enqueue, push in stack 1, for Dequeuing, pop all from stack 1 , push to stack 2, Finally pop stack 1

2