MediumDesign· 50% acceptance
#982

Min Stack 2

Medium

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

runMinStack

← All practice problems