Range Sum Query - Mutable
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive.
The update(i, val) function modifies nums by updating the element at index i to val.
Given nums = [1, 3, 5]
sumRange(0, 2) -> 9
sumRange(0, 2) -> 8
The array is only modifiable by the update function.
You may assume the number of calls to update and sumRange function is distributed evenly.
Login to see Answer and Coaching Session
More interview questions