Implement a queue data structure using two stacks
Anonymous
Queue - First In Last Out Insert the elements into the stack one by one. For removing, use another stack. Pop all the elements from the original stack and insert in the second stack. Now if we pop the element from the second stack, that will be in FIFO order. Basically -(-1) = 1, so Stack(stack) = Queue
Check out your Company Bowl for anonymous work chats.