Python3 Solution
\n\nclass Solution:\n    def getSumAbsoluteDifferences(self, nums: List[int]) -> List[int]:\n        n=len(nums)\n        ans=[]\n        total=0\n        for n
\n```\nclass Solution:\n    def getSumAbsoluteDifferences(self, nums: List[int]) -> List[int]:\n        n=len(nums)\n        ans=[]\n        total=0\n        for num in nums:\n            total+=abs(num-nums[0])\n        ans.append(total)\n        for idx in range(1,n):\n            res=nums[idx]-nums[idx-1]\n            total+=res*idx\n            total-=res*(n-idx)\n            ans.append(total)\n        return ans        \n```
['Python', 'Python3']