Back to the 100
Problem 078Stack
Medium

Min Stack

078

Simulate a min stack. Operations are push, pop, top, and getMin. Return outputs for top and getMin.

EXAMPLES

Example 1
Input
{
  "operations": [
    "push",
    "push",
    "push",
    "getMin",
    "pop",
    "top",
    "getMin"
  ],
  "values": [
    -2,
    0,
    -3,
    0,
    0,
    0,
    0
  ]
}

Output
[
  -3,
  0,
  -2
]

FUNCTION SHAPE

operations: stringArrayvalues: intArrayintArray
00:00
1 local tests readyRun with ⌘/Ctrl + Enter. Your code stays in this browser.

Runs solve(...) locally in a browser worker. SWE Playbook does not submit your code. Only run code you trust; Python code may access the network.