Problem context and objectives
Mission briefing
Game event engineer · Actions arrive faster than the world can resolve them
Process events in the exact order promised by the data structure: The Warmer Horizon.
The wrong removal order changes gameplay and creates impossible replays.
How you win
- 1Recognize when Monotonic wait stack matches the clues
- 2Keep this true after every move: stack temperatures are non-increasing, including equal temperatures, and their waits are not yet known
- 3Reach the result within O(n)
Rules and pressure
- Target cost: O(n)
- State rule: stack temperatures are non-increasing, including equal temperatures, and their waits are not yet known
Lesson 1 of 3
The waiting stack stores indices of colder unresolved days. When warmth arrives, the answer is the index distance, not the temperature.
Your call · Day 2 is 75 and day 6 reaches 76. What is the wait?