Problem from Hackerrank
You have an empty sequence, and you will be given N queries. Each query is one of these three types:
- Push the element
x
into the stack. - Delete the element present at the top of the stack.
- Print the maximum element in the stack.
The first line of input contains an integer, N
. The next N
lines each contain an above mentioned query. (It is guaranteed that each query is valid.)
Input:
10
1 97
2
1 20
2
1 26
1 20
2
3
1 91
3
Output::
26
91