[C++] EASY TO UNDERSTAND ✅✅✅
\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        vector<int> prefix = nums;\n        for(int i = 1 ; i < pre
```\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        vector<int> prefix = nums;\n        for(int i = 1 ; i < prefix.size() ;i++){\n            prefix[i] = prefix[i] + prefix[i-1];\n        }\n        vector<int> ans;\n        for(int i = 0 ;i<nums.size() ;i++){\n            int leftsum;\n            int rightsum;\n            int leftpro=0;\n            int rightpro=0;\n            if(i!=0){\n                leftsum = prefix[i-1];\n                leftpro = nums[i]*(i);\n            }else leftsum = 0 ;\n            if(i!=nums.size()-1){\n                rightsum = prefix[prefix.size()-1] - prefix[i];\n                rightpro = nums[i]*(prefix.size()-i-1);\n            }\n            else rightsum = 0;\n            \n            int result = rightsum - rightpro + leftpro - leftsum;\n            ans.push_back(abs(result));\n        }\n        return ans;\n    }\n};\n```
['C', 'Prefix Sum']