Stack Class

Programming Interview Easy 7 views
Back to Questions

Problem Description

You will receive q commands: PUSH x, POP, TOP. Create Stack class and for TOP output value or EMPTY.

Input Format

First line q. Next q lines commands.

Output Format

Outputs for TOP.

Sample Test Case

Input:
7 PUSH 5 TOP PUSH 3 TOP POP TOP POP
Output:
5 3 5

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next