JSolved: Finding out running Maximum element from stack
Finding out running Maximum element from stack
You have an empty sequence, and you will be given queries. Each query is one of these three types:
For each query of type 3 return the max element from the current stack.
Input:
- 1 num 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.
For each query of type 3 return the max element from the current stack.
Input:
Read full article from JSolved: Finding out running Maximum element from stack
No comments:
Post a Comment