Search
⌘K

Leetcode 155. Min Stack

Design a stack supporting push, pop, top, and getMin operations all in O(1) time. The core challenge is to maintain and update the current minimum efficiently so getMin returns the smallest element present even after arbitrary pushes and pops.

Asked at:

Snowflake


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Early September, 2025

Snowflake

Senior

Mid June, 2025

Snowflake

Mid-level

Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Constraints: All operations will invariably be called on non-empty stacks.

Comments

Your account is free and you can post anonymously if you choose.