Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.
push(x)pushes elementxonto the stack.pop()removes the element on top of the stack.top()returns the element on top of the stack.getMin()returns the minimum element currently in the stack.
Each of these must run in O(1) time.
Implement the function minStack(operations) where operations is a list of [op, ...args]. The supported operations are ["push", x], ["pop"], ["top"], and ["getMin"]. For "push" and "pop" return null; for "top" return the top value; for "getMin" return the current minimum. Return the list of results, one per operation (use null for operations that return nothing).