JAVA | SOLUTION | BRUTE FORCE
```\n\nclass NumArray {\n    List al = new ArrayList<>();\n    int totalSum=0;\n    public NumArray(int[] nums) {\n        for(int i=0;i<nums.length;i++){\n    
```\n\nclass NumArray {\n    List<Integer> al = new ArrayList<>();\n    int totalSum=0;\n    public NumArray(int[] nums) {\n        for(int i=0;i<nums.length;i++){\n            al.add(nums[i]);\n            totalSum+=nums[i];\n        }\n    }\n    \n    public void update(int index, int val) {\n        totalSum = totalSum + (val) - al.get(index);\n        al.set(index,val);\n    }\n    \n    public int sumRange(int left, int right) {\n        int sum=totalSum;\n        for(int i=0;i<left;i++){\n                sum = sum - al.get(i);\n        }\n        for(int i=right+1;i<al.size();i++)\n            sum = sum - al.get(i);\n        return sum;\n    }\n}
['Java']