[easy understanding][beginner friendly][c++]
\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        int leftsum = 0, n = nums.size(),rightsum =0;\n        for(
```\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        int leftsum = 0, n = nums.size(),rightsum =0;\n        for(int i=0;i<n;i++) \n            rightsum+=nums[i];\n        for (int i = 0; i < n; i++) {\n            rightsum -= nums[i];\n            leftsum += nums[i];\n            nums[i] = rightsum - nums[i] * (n - i - 1) - leftsum + nums[i] * (i + 1);\n        }\n        return nums;\n    }\n};\n```\n**Feel free to ask any question in the comment section.**\nI hope that you\'ve found the solution useful.\nIn that case, **please do upvote and encourage me** to on my quest to document all leetcode problems\uD83D\uDE03\nHappy Coding :)\n
['C', 'C++']