AlgoMaster Logo

Min Stack

operations=[push -2, push 0, push -3, getMin, pop, top, getMin]
0 / 16
operationspush -2push 0push -3getMinpoptopgetMin0123456valminstack
algomaster.io
Step:MinStack: each entry stores [value, currentMin] so getMin is O(1)