Problem 239 · Hard
Monotonic deque stores indices in decreasing value order; dequeue expired and smaller elements per step.
Open the interactive visualisation