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 Histogram Citadel.
The wrong removal order changes gameplay and creates impossible replays.
How you win
- 1Recognize when Increasing boundary stack matches the clues
- 2Keep this true after every move: stack heights are non-decreasing, including equal heights, and every stacked bar can still extend through the processed prefix
- 3Reach the result within O(n)
Rules and pressure
- Target cost: O(n)
- State rule: stack heights are non-decreasing, including equal heights, and every stacked bar can still extend through the processed prefix
Lesson 1 of 3
A shorter incoming wall fixes the right boundary of taller tops. Only after popping does the exposed top reveal the left boundary and maximum width.
Your call · Height 2 arrives after heights 5 and 6. What width closes height 5?