LeetCode 307 Range Sum Query - Mutable - Problem Statement

The problem

Support update(index, val) and sumRange(left, right) efficiently.

Once you solve it, you'll recognize when input structure allows efficient traversal in similar problems. Focus on understanding why this approach works. Once you grasp the pattern, similar problems become straightforward to solve.

Example: Array [1,3,5], sumRange(00,22) = 99, update(11,22), sumRange(00,22) = 88.

Constraints: 11 \le nums.length 3×104\le 3 \times 10^4. Up to 3×1043 \times 10^4 calls.