Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 493 Bytes

File metadata and controls

15 lines (11 loc) · 493 Bytes

Problem 3: FIFO Simulation

Problem Statement

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).

Input Format

  • Method calls.

Constraints

  • 1 <= x <= 9
  • At most 100 calls will be made to various methods.

Example

Input: ["MyQueue", "push", "push", "peek", "pop", "empty"] [[], [1], [2], [], [], []]
Output: [null, null, null, 1, 1, false]