Back to Question

Implement a Queue using Stacks

Question Explain

Implement a First-In-First-Out (FIFO) queue using only two stacks. The implemented queue should support all the functions of a normal queue (`push`, `peek`, `pop`, and `empty`).

Start Trying This Question Simulation

Click "Start Speaking" and answer the question naturally.