Brute Force | C++
\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        vector<int>res(nums.size());\n        int sum=0,s=nums.size
```\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        vector<int>res(nums.size());\n        int sum=0,s=nums.size();\n        for(int i=0;i<s;i++)\n            sum+=nums[i];\n        int psum=0;\n        for(int i=0;i<s;i++){\n            res[i]=(nums[i]*i -psum)+(sum- psum- nums[i]*(s-i));\n            psum+=nums[i];\n        }\n        return res;\n    }\n};\n```
[]