11
How would you implement a queue using stacks?
Tap to write answer
0 words | 0 charsPress Enter ↵ to reveal
Your Attempt
0 wordsRefined Model Answer
ReferenceI would use one stack for incoming items and another for outgoing items. When the outgoing stack is empty, I move items from the incoming stack to reverse their order. That gives queue behavior while still using stack operations.