Stack that knows its minimum
Write a class MinStack: a stack of integers where every operation runs in O(1).
push(x)putsxon top.pop()removes the top value and returns it.top()returns the top value without removing it.get_min()returns the smallest value currently in the stack.
Values may be negative and may repeat. pop, top and get_min are never called on an empty stack.
The tests call the provided run_stack(ops): it applies each operation in order and returns the list of results (None for push, shown as null).
Examples
run_stack([["push",5],["push",3],["push",7],["get_min"],["pop"],["pop"],["get_min"],["top"]])→[null,null,null,3,7,3,5,5]run_stack([["push",2],["push",2],["pop"],["get_min"],["top"]])→[null,null,2,2,2]