Implement queue with stacks in O(1) push/pop complexity.
Anonymous
Amortized complexity of O(1) possible; designated push and pop stacks. Reverse (empty) push stack into the pop stack only when a pop operation is called and the pop stack is empty.
Check out your Company Bowl for anonymous work chats.