Min Stack
Design a stack that supports push, pop, top, and getMin in O(1) time. Think about: How can you track the minimum efficiently? Hint: Consider using an auxiliary structure to track minimums. Example: push(-2), push(0), push(-3) get_min() → -3 pop() top() → 0 get_min() → -2
Min Stack is all about maintaining a clear stack meaning as you process input. Interviewers love it because it reveals your stack invariants and your edge-case discipline. The classic mistake is not being clear about what your stack represents at each step.

Meet Coco
Coco is an AI study partner, not a person. She listens while you explain your code, asks what a line does and never hands you the fix. Typing with Coco is free when you sign in, up to a daily limit. Talking with her out loud comes with the $79 pack. Anyone can open the editor and run their code.