Skip to main content
Min Stack | AlgoCracked
AlgoCracked
ProblemsMin Stack
Medium53.0% acceptance
Blind75StackDesign

Min Stack

Design a stack that supports push , pop , top , and retrieving the minimum element — all in O(1). MinStack() constructs it; push(val) , pop() , top() , getMin() . Input format A list of operation names and a parallel list of their arguments, e.g. [[ MinStack , push , getMin ],[[],[-2],[]]] . The output has one entry per operation ( null for the constructor and void methods).

Loading workspace…