https://leetcode.com/problems/sum-of-absolute-differences-in-a-sorted-array/class Solution: def getSumAbsoluteDifferences(self, nums: List[int]) -> List[int]: total_sum = sum(nums) left_sum = 0 res = [] for i , n in enumerate(nums): right_sum = total_sum - n - left_sum left_size, right_size = i , len(nums) - i -1 res.append( ..