Sliding Window Maximum — a max-heap with lazy deletion
A max-heap keeps the largest value on top. As the window slides, entries whose index has fallen off the left are stale — pop them off the top only when they surface, then read the max.
Try:
← Prev
Next →
▶ Play
Reset
nums
heap
(value@index, largest on top)
window maximums