Skip to content

Latest commit

 

History

History
11 lines (8 loc) · 407 Bytes

File metadata and controls

11 lines (8 loc) · 407 Bytes

Problem 4: LIFO Simulation

Problem Statement

Implement a last-in-first-out (LIFO) stack using only two queues. The implemented stack should support all the functions of a normal stack (push, top, pop, and empty).

Input Format

  • Method calls.

Example

Input: ["MyStack", "push", "push", "top", "pop", "empty"] [[], [1], [2], [], [], []]
Output: [null, null, null, 2, 2, false]