Stack pattern
Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element, all in O(1) time. Watch it run step by step, then write your own pseudocode and get it checked by AI.
- LeetCode 155
- Medium
- 1 approach
Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.
StackLeetCode 155
Medium
The approach
- 01 Twin min-stack O(1) per opO(n) space
What you will learn
- How to read Min Stack and spot the stack pattern in it
- Twin min-stack: O(1) per op time, O(n) space
- The pseudocode for each approach, its line lit as the animation runs
- Practice: write your own pseudocode and get it checked
More Stack
See Min Stack run, step by step
Sign in and this page opens on the animation, with all 8 Stack problems beside it.
DSA comes with the all labs plan and every ChaiCode batch.