[Java] Simple O(N) suffix sum solution with O(1) space
\nclass Solution {\n    public int[] getSumAbsoluteDifferences(int[] nums) {\n        int left = 0;\n        int right = 0;\n        \n        for (int num : nu
```\nclass Solution {\n    public int[] getSumAbsoluteDifferences(int[] nums) {\n        int left = 0;\n        int right = 0;\n        \n        for (int num : nums) {\n            right += num;\n        }\n        \n        int[] result = new int[nums.length];\n        \n        for (int i = 0; i < nums.length; i++) {\n            right -= nums[i];\n            \n            int fromLeft = nums[i] * i - left;\n            int fromRight = right - (nums.length - i - 1) * nums[i];\n            result[i] = fromLeft + fromRight;\n            \n            left += nums[i];\n        }\n        \n        return result;\n    }\n}\n```
[]