0370. Range Addition
Last updated
Last updated
https://leetcode.com/problems/range-addition
You are given an integer length
and an array updates
where updates[i] = [startIdxi, endIdxi, inci]
.
You have an array arr
of length length
with all zeros, and you have some operation to apply on arr
. In the ith
operation, you should increment all the elements arr[startIdxi], arr[startIdxi + 1], ..., arr[endIdxi]
by inci
.
Return arr
after applying all the updates
.
Example 1:
Example 2:
Constraints:
1 <= length <= 105
0 <= updates.length <= 104
0 <= startIdxi <= endIdxi < length
-1000 <= inci <= 1000