Problems > Increasing Array > Editorial

Increasing Array — Solution & Editorial

Back to the Problem

Sweep with the running required minimum: every element below it must be raised exactly to it; every element above raises the bar.

Complexity: O(N)

Watch out: The total reaches ~1014 — 64-bit.