Problem 2772 · Medium

Apply Operations to Make All Array Elements Equal to Zero

Sweep left to right: each position must be lowered by exactly the operations still covering it, so start only the operations it needs.

Open the interactive visualisation