C#- Simple O(N) solution using prefix sum
csharp\npublic int[] GetSumAbsoluteDifferences(int[] nums)\n{\n\tint[] prefixSum = new int[nums.Length + 1];\n\n\tfor (int i = 0; i < nums.Length; i++)\n\t{\n\t
```csharp\npublic int[] GetSumAbsoluteDifferences(int[] nums)\n{\n\tint[] prefixSum = new int[nums.Length + 1];\n\n\tfor (int i = 0; i < nums.Length; i++)\n\t{\n\t\tprefixSum[i + 1] = prefixSum[i] + nums[i];\n\t}\n\n\tint[] result = new int[nums.Length];\n\n\tfor (int i = 0; i < nums.Length; i++)\n\t{\n\t\tint right = (prefixSum[nums.Length] - prefixSum[i + 1]) - nums[i] * (nums.Length - i - 1);\n\t\tint left = 0;\n\n\t\tif (i > 0)\n\t\t{\n\t\t\tleft = nums[i] * i  - prefixSum[i];\n\t\t}\n\n\t\tresult[i] = left + right;\n\t}\n\n\treturn result;\n}\n```
[]