C++ | O(N) Easy Solution | Short & Simple
\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        int sum = 0 , cur = 0 , n = nums.size();\n        vector<in
```\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        int sum = 0 , cur = 0 , n = nums.size();\n        vector<int> ans(n);\n        for(int i = 0;i<n;i++)sum+=nums[i];\n        for(int i = 0;i<n;i++){\n            ans[i] = ((i*nums[i]) - cur) + ((sum-cur-nums[i])-((n-i-1)*nums[i]));\n            cur+=nums[i];\n        }\n        return ans;\n    }\n};\n```
[]