← Questions

Queue using two stacks

0
AppleCodingLast asked Jun 2026

A coding interview question asked in Apple's coding round, last asked Jun 2026. It tests stacks, queues and amortized analysis.

Implement a first-in, first-out queue using only two stacks. The only stack operations you may use are push to top, pop from top, peek at top, size and is-empty.

Sign in to unlock this question

The full prompt, the worked answer and your own canvas or code with the AI tutor. New accounts get 5 credits: each one unlocks a question for good.

Where it's asked

  • Apple · Coding · Last asked Jun 2026

What it tests

stacks · queues · amortized analysis

Your code and the AI tutor open when you unlock this question.