LeetCode 155: Min Stack — Step-by-Step Visual Trace
Medium — Stack | Design | Data Structure
The Problem
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. All operations must be performed in O(1) time complexity.
Approach
Use two stacks - one main stack ...
blog.tracelit.dev1 min read