✅ [C++ Solution] | Fast and Easy | Simple Code
If You Find it Hepful Kindly UPVOTE\n\nC++ Easy and Simple Solution\n\n\nclass NumArray {\npublic:\n    vector<int> temp;\n    int sum=0;\n    NumArray(vector<i
**If You Find it Hepful Kindly UPVOTE**\n\n**C++ Easy and Simple Solution**\n\n```\nclass NumArray {\npublic:\n    vector<int> temp;\n    int sum=0;\n    NumArray(vector<int>& nums) {\n        temp=nums;\n        sum=accumulate(nums.begin(),nums.end(),0);  //Sum of all Elemnts in vector\n    }\n    \n    void update(int index, int val) {\n        sum-=temp[index];\n        sum+=val;\n        temp[index]=val;\n    }\n    \n    int sumRange(int left, int right) {\n        int ans=sum;\n        for(int i=0;i<left;i++)\n            ans-=temp[i];\n        for(int i=right+1;i<temp.size();i++)\n            ans-=temp[i];\n        return ans;\n    }\n};\n```\n**If You Find it Hepful Kindly UPVOTE**
['C', 'C++']