It is just another version of the preview problem. It is easy for beginners like this code:

```
class NumArray {
public:
vector<int> res;
NumArray(vector<int> &nums) {
res.push_back(0);
int sum=0;
for(int i=0;i<nums.size();i++)
{
sum+=nums[i];
res.push_back(sum);
}
}
void update(int i, int val) {
int dif=val-(res[i+1]-res[i]);
for(int j=i+1;j<res.size();j++)
res[j]+=dif;
}
int sumRange(int i, int j) {
return res[j+1]-res[i];
}
};
```