employer cover photo
employer logo
employer logo

ROVI Pharmaceuticals

Is this your company?

ROVI Pharmaceuticals interview question

Use stack in place of queues

Interview Answer

Anonymous

18 Feb 2012

Can be achieved using two stacks. While 'pop' is called, transfer all values from stack1 to stack2. And return (stack2.pop()). Then transfer back all elements from stack2 to stack1. This behaves as a queue (FIFO).