Implement Queue Using Two Stacks
Easy
Queue
Implement a FIFO queue using only two stacks. Support push x, pop, peek and empty. Print the result of every pop, peek and empty operation, one per line.
Constraints
1 <= q <= 100 1 <= x <= 9 Pop and peek are only called on a non-empty queue
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.