Design a stack that supports getMin() in O(1) time and O(1) extra space
If you can teach Design a stack that supports getMin() in O(1) time and O(1) extra space using undo typing, you know it. If you only know the heading, you don’t.
Keep Design a stack that supports getMin() in O(1) time and O(1) extra space small. Meera should finish undo typing in a few lines, not a 40-line dump.
Design a stack that supports getMin() in O(1) time and O(1) extra space exists so Meera can keep undo typing correct in a tiny editor.
Meera ships Design a stack that supports getMin() in O(1) time and O(1) extra space in a tiny editor. That is the use case worth saying.
Design a stack that supports getMin() in O(1) time and O(1) extra space trap: pop on empty. Meera loses marks for that every viva.
After Design a stack that supports getMin() in O(1) time and O(1) extra space, Meera should still remember pop on empty.
One breath for Design a stack that supports getMin() in O(1) time and O(1) extra space, then undo typing, then pop on empty. Sit down.
| 3 | ← top (pop)
| 2 |
| 1 |
LIFOFor Design a stack that supports getMin() in O(1) time and O(1) extra space: definition + a tiny editor + one failure.