Design a stack that supports push, pop, top, and retrieving the minimum element — all in O(1).
Input: one operation per line —
push x — push integer xpop — remove the toptop — read the topgetMin — read the minimumOutput: one line per operation — push and pop print null; top and getMin print their result. Operations are always valid (no pop/top on an empty stack).
push -2 push 0 push -3 getMin pop top getMin
null null null -3 null 0 -2
Run your code against the sample tests, or Submit to run the full suite.