esiest python solution easy to understand
\nclass NumArray:\n\n    def __init__(self, nums: List[int]):\n        self.num_array=nums\n        self.pre_sum=sum(self.num_array)  # lets keep sum at the ent
```\nclass NumArray:\n\n    def __init__(self, nums: List[int]):\n        self.num_array=nums\n        self.pre_sum=sum(self.num_array)  # lets keep sum at the entry\n    def update(self, index: int, val: int) -> None:\n        self.pre_sum=self.pre_sum - self.num_array[index] + val # we will not calculate the whole sum again we will just remove old value and add newone \n        self.num_array[index]=val\n        \n    def sumRange(self, left: int, right: int) -> int:\n        return self.pre_sum - sum(self.num_array[:left]) - sum(self.num_array[right+1:]) # we will calculate before left sum and after right and minus from whole sum \n    \n    \n    # thats it here we go as simple as that\n```
['Python']