MediumDesign· 61% acceptance
#1010

Min Stack 30

Medium

Design a stack that supports `push`, `pop`, and `getMin` in O(1). Implement `MinStack` as a class/constructor. Variant **#30**. For this problem, return the results of each operation in order.

Example 1

Input: operations (see test cases)

Output: [null, null, null, -2, null, 0]

Constraints

  • Methods pop, getMin, push are always valid

Acceptance: 61% · Topics: design, stack

runMinStack

← All practice problems