Min Stack
A Min Stack supports normal Stack operations while also returning the minimum element in O(1). A common design maintains a second stack containing the minimum value corresponding to each stack state.
Push: O(1).
Pop: O(1).
Peek: O(1).
GetMin: O(1).
Auxiliary space: O(n).
An alternative stores only values that establish new minimums, reducing typical auxiliary storage.
0-2 years experience
2-5 years experience
5-8 years experience
8+ years experience