Given an integer array nums sorted in nondecreasing order.
Build and return an integer array result of the same length, where result[i] is equal to the sum of the absolute differences between nums[i] and every element in nums.
In other words, result[i] is equal to nums[i] nums[j]j nums.length.
Constraints:
nums.length
nums[i] nums[i + 1]
Given an integer array nums sorted in nondecreasing order.
Build and return an integer array result of the same length, where result[i] is equal to the sum of the absolute differences between nums[i] and every element in nums.
In other words, result[i] is equal to nums[i] nums[j]j nums.length.
Constraints:
nums.length
nums[i] nums[i + 1]