Min Stack Operations
Simulate a stack that supports push x, pop, top and min, each in . You are given a list of operations as strings. Return the outputs of every top and min operation, in order. Operations are always valid.
Examples
EXAMPLE WALKTHROUGHclassic
A guided view of the published example, not a trace of your code.
INPUT
[["push -2","push 0","push -3","min","pop","top","min"]]TASKmin_stack_operations()
EXPECTED OUTPUT
[-3,0,-2]Start with the input values shown in this example.
Example 1 of 3
Input: operations = ["push -2","push 0","push -3","min","pop","top","min"]
Output: [-3,0,-2]
Explanation: classic
Input: operations = ["push 5","min","push 5","pop","min"]
Output: [5,5]
Explanation: duplicates
Input: operations = ["push 1","top"]
Output: [1]
Explanation: single
Hint 1
Store pairs (value, minimum so far) on the stack.