Problem
Start with an array of length zeros. Each update [start, end, inc] adds inc to every element from index start to index end, inclusive (indices are 0-based). Apply all updates and return the final array.
Example 1
length = 5, updates = [[1, 3, 2], [2, 4, 3], [0, 2, -2]]
Example 2
→ [-2, 0, 3, 5, 3]
Example 3
- Input
- length = 3, updates = []
- Output
- [0, 0, 0]
Constraints
1 <= length <= 10^50 <= updates.length <= 10^40 <= start <= end < length-1000 <= inc <= 1000