Tap here to switch tabs
Problem
Submissions

Problem: Range Addition

Try to solve the Range Addition problem.

Statement

You are given an integer length and an array of update operations updates, where each operation is represented as updates[i] = [startIdxi_i, endIdxi_i, inci_i].

Assume you have an array of size length where every element is initially set to 00.

For each operation updates[i], you need to increment all elements in the range from index startIdxi_i to endIdxi_i (inclusive) by inci_i.

Return the modified array after applying all the updates.

Constraints:

  • 1≤1 \leq length ≤105\leq 10^5

  • 0≤0 \leq updates.length ≤104\leq 10^4

  • 0≤0 \leq startIdxi≤_i \leq endIdxi<_i < length

  • −1000≤-1000 \leq inci≤1000_i \leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Range Addition

Try to solve the Range Addition problem.

Statement

You are given an integer length and an array of update operations updates, where each operation is represented as updates[i] = [startIdxi_i, endIdxi_i, inci_i].

Assume you have an array of size length where every element is initially set to 00.

For each operation updates[i], you need to increment all elements in the range from index startIdxi_i to endIdxi_i (inclusive) by inci_i.

Return the modified array after applying all the updates.

Constraints:

  • 1≤1 \leq length ≤105\leq 10^5

  • 0≤0 \leq updates.length ≤104\leq 10^4

  • 0≤0 \leq startIdxi≤_i \leq endIdxi<_i < length

  • −1000≤-1000 \leq inci≤1000_i \leq 1000