Optimal Algorithmic Approach
Monotonic Decreasing Stack: each element is pushed and popped at most once.
Core Invariants & Edge Cases
- Maintain a monotonically decreasing stack of indices
- When a warmer temperature is found, pop and compute distance
- Unresolved indices in stack get 0