Skip to content

mahecode/MaximumElement-Hackerrank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MaximumElement-Hackerrank

https://www.hackerrank.com/challenges/maximum-element/problem

You have an empty sequence, and you will be given queries. Each query is one of these three types:

1 x -Push the element x into the stack. 2 -Delete the element present at the top of the stack. 3 -Print the maximum element in the stack.

Input Format

The first line of input contains an integer, . The next lines each contain an above mentioned query. (It is guaranteed that each query is valid.)

Constraints

Output Format

For each type query, print the maximum element in the stack on a new line.

Sample Input

10 1 97 2 1 20 2 1 26 1 20 2 3 1 91 3

Sample Output

26 91