Coding Questions

Microsoft: Implement a queue with two stacks with O(1) enqueue and O(1) dequeue.

Two people seated across a table during a job interview.
Photo by Amtec Photos on Wikimedia Commons · CC BY-SA 2.0

Microsoft:

Implement a queue with two stacks with O(1) enqueue and O(1) dequeue.

 

Originally published on WordPress. View the source version ↗

Comments