C++||Basic Observation|| O(N) Time Approach
**   APPROACH**\n   [1,4,6,8,10] lets say we have to find the sum of all absolute difference of number 6 then we notice it is:\n        \n        10 - 6\n      
**   APPROACH**\n   [1,4,6,8,10] lets say we have to find the sum of all absolute difference of number 6 then we notice it is:\n        \n        10 - 6\n        8 - 6\n    -------------\n    Or sum of all elements to the right - (no of elements in right * present element i.e., 6)\n    \n    and also we do : \n    \n        6 - 4\n        6 - 1\n     ------------\n     (present element * no of element to the left) - sum of all elements to the left\n     \n     SUM UP THESE TWO THINGS WE GET THE ANSWER :\n     NOTE : \n            To get the right sum we do : TOTAL SUM - PRESENT ELEMENT - LEFT SUM\n```\nclass Solution \n{\npublic:\n    vector<int> getSumAbsoluteDifferences(vector<int>& nums) \n    {\n        int n = nums.size();\n        vector<int> ans(n);\n        \n        int sum = accumulate(nums.begin() , nums.end() ,sum);\n        \n        int leftSum = 0 , rightSum = 0;\n        for(int i=0 ; i<nums.size() ; i++)\n        {\n            rightSum = sum - nums[i] - leftSum;\n            ans[i] = (rightSum - (nums[i]*(n-i-1))) + ((nums[i]*i) - leftSum);\n            leftSum = leftSum + nums[i];\n        }\n        return ans;\n    }\n};\n```
[]