Min Stack Class

Programming Interview Hard 8 views
Back to Questions

Problem Description

You will receive q commands: PUSH x, POP, MIN. Create MinStack class and for MIN output current minimum or EMPTY.

Input Format

First line q. Next q lines commands.

Output Format

Outputs for MIN.

Sample Test Case

Input:
7 PUSH 5 PUSH 2 MIN POP MIN POP MIN
Output:
2 5 EMPTY

Constraints

q

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next