MediumDesign· 56% acceptance
#1005

Min Stack 25

Medium

Design a stack that supports `push`, `pop`, and `getMin` in O(1). Implement `MinStack` as a class/constructor. Variant **#25**. 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: 56% · Topics: design, stack

runMinStack

← All practice problems