90% FATER || 99% SPACE BETAS || C++
\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        int n = nums.size(),s1 = 0,s2 = 0;\n        vector<int> v(n
```\nclass Solution {\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) {\n        int n = nums.size(),s1 = 0,s2 = 0;\n        vector<int> v(n,0);\n        for(auto &i: nums){\n            s2 += i;\n        }\n        for(int i = 0; i < n; i++){\n            v[i] = s2-nums[i]*(n-i)-(s1-nums[i]*i);\n            s2 -= nums[i];\n            s1 += nums[i];\n        }\n        return v;\n    }\n};\n```
['Array', 'Math', 'C', 'Prefix Sum', 'C++']