Practice
Learn
← Quit
0 / 0 correct
Data Structures
Hard
1 of 40
How can a queue be built from two stacks with amortized O(1) operations?
A
Use one stack and reverse it each time
B
Push onto an 'in' stack; when the 'out' stack is empty, pour all of 'in' into 'out' and pop from 'out'
C
It can't be done
D
Copy both stacks on every operation