Python || Sqrt Decomposition || 90.77% space optimized
Upvote if you like it!\nP.S. Completed monthly challenge for the first time :)\n\nclass NumArray:\n\n    def __init__(self, nums: List[int]):\n        self.sqrt
***Upvote if you like it!***\nP.S. Completed monthly challenge for the first time :)\n```\nclass NumArray:\n\n    def __init__(self, nums: List[int]):\n        self.sqrt = int(len(nums)**(0.5))\n        self.sumarr = [0]*(len(nums)//self.sqrt+(len(nums)%self.sqrt!=0)*1)\n        self.nums = nums\n        for i in range(len(nums)):\n            self.sumarr[i//self.sqrt]+=nums[i]\n        \n        \n    def update(self, index: int, val: int) -> None:\n        oldv = self.nums[index]\n        self.nums[index] = val\n        self.sumarr[index//self.sqrt] += val - oldv \n\n    def sumRange(self, left: int, right: int) -> int:\n        lidx = left//self.sqrt\n        ridx = right//self.sqrt\n        tsum = 0\n        \n        for i in range(lidx+1,ridx): # Overlapping blocks\n            tsum+=self.sumarr[i]\n            \n        for i in range(left,min(right+1,((lidx+1)*self.sqrt))): # first block\n            tsum+=self.nums[i]\n                       \n        if ridx!=lidx: # last block\n            for i in range(ridx*self.sqrt,right+1):\n                tsum+=self.nums[i]\n        return tsum\n\n\n# Your NumArray object will be instantiated and called as such:\n# obj = NumArray(nums)\n# obj.update(index,val)\n# param_2 = obj.sumRange(left,right)\n```
['Python']