Range Sum Query - Mutable
Given an integer array nums, handle multiple queries of the following types: Update the value of an element in nums. Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. Implement the NumArray class with update(index, val) and sumRange(left, right) methods.
Range Sum Query - Mutable

Given an integer array nums, handle multiple queries of the following types: Update the value of an element in nums. Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. Implement the NumArray class with update(index, val) and sumRange(left, right) methods.

Example 1:
Input: {"nums":[1,3,5],"operations":["sumRange","update","sumRange"],"params":[[0,2],[1,2],[0,2]]}
Output: [9,null,8]
Input
arr ={"nums":[1,3,5],"operations":["sumRange","update","sumRange"],"params":[[0,2],[1,2],[0,2]]}

Built segment tree from array [1, 3, 5]

Array
[0]

1

[1]

3

[2]

5

Operation: construct
Segment Tree
9
8
1
3
5
Variables
No variables to display
DepthFunction Call
Stack empty
0/3