Python data engineering interview problem. Difficulty: intermediate. Pattern: Stacks. About 14 minutes. Part of the Pro drill bank.
Stack that also retrieves the current minimum in O(1). Treat this as a production helper: match the contracted return shape, including empty and duplicate inputs.
Implement class MinStack with push(x), pop(), top(), and getMin().
Input: push -2,0,-3; getMin; pop; top; getMin Output: -3, 0, -2 Min updates after pop.
Topics: lakebench, python, min, stack.
More Python interview questions · All interview problems · Learn data engineering
Interview-style drill: Stack that also retrieves the current minimum in O(1).
Implement class `MinStack` with `push(x)`, `pop()`, `top()`, and `getMin()`. Keep the harness prints.