arr
of length length
with all zeros.updates
.
a. For each update [startIdx, endIdx, inc]
, increment arr[startIdx]
by inc
.
b. If endIdx + 1
is within bounds, decrement arr[endIdx + 1]
by inc
.arr
from the second element to the end.
a. For each index i
from 1 to length - 1
, add arr[i - 1]
to arr[i]
.arr
.