Implement a queue with two stacks (enqueue, dequeue, peek)
Anonymous
To enqueue, pop all of stack B onto onto stack A, push onto stack A. To dequeue, pop all of stack A onto stack B, then pop stack B. To peek, pop all of stack A onto stack B, then peek stack B.
Check out your Company Bowl for anonymous work chats.