Sollicitatievraag bij APT Research

Implement queue with stacks in O(1) push/pop complexity.

Antwoord op sollicitatievraag

Anoniem

12 aug 2025

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.