O(n) python
The absolute difference between two numbers a and b is:\n\n- a - b: When a is greater than or equal to b.\n- b - a: When a is less than or equal to b.\n\nThese 
The absolute difference between two numbers `a` and `b` is:\n\n- `a - b`: When `a` is greater than or equal to `b`.\n- `b - a`: When `a` is less than or equal to `b`.\n\nThese cases overlap when `a` is equal to `b`, but in that case `a - b` and \n`b - a` are both equal to `0`, so it\'s ok.\n\nFix some index 0 \u2264 i \\< n. Since our array is non-decreasing, the sum of the\nabsolute difference between `nums[i]` and the elements to its left will just be\n`i` times `nums[i]` minus the sum of the numbers to its left, and the sum of the\nabsolute difference between `nums[i]` and the elements to its right will be the\nsum of the elements to its right minus the number of elements to its right \n(`n - i - 1`) times `nums[i]`.\n\n```python\ndef getSumAbsoluteDifference(nums):\n    n = len(nums)\n    sumBelow, sumAbove = 0, sum(nums)\n    result = []\n    \n    for i, num in enumerate(nums):\n        sumAbove -= num\n        result.append(sumAbove - (n - 1 - i) * num + i * num - sumBelow)\n        sumBelow += num\n\n    return result\n```\n
[]