370 Range Addition
370. Range Addition
1. Question
Assume you have an array of lengthninitialized with all0's and are given k update operations.
Each operation is represented as a triplet: [startIndex, endIndex, inc] which increments each element of subarrayA [startIndex ... endIndex](startIndex and endIndex inclusive) with inc.
Return the modified array after allkoperations were executed.
Example:
Explanation:
2. Implementation
3. Time & Space Complexity
时间复杂度O(n + k), 空间复杂度O(n)
Last updated