Company: Nokia_14june
Difficulty: easy
You are given a sorted integer array in non-decreasing order. Your task is to create a new array where each element represents the total absolute distance between that element and all other elements in the original array. For each position i , calculate the sum of absolute differences |nums[i] - nums[j]| for all valid indices j (excluding i itself). This creates a distance map showing how "far" each element is from all others in the array. Input Format The first line contains a single integer n , the number of elements in the array. The second line contains n space-separated integers representing the sorted array elements. Output Format Print n space-separated integers on a single line, where the i -th value is the sum of absolute differences for position i . Constraints 2 ≤ n ≤ 10 5 1 ≤ nums[i] ≤ 10 4 nums[i] ≤ nums[i+1] (the array is sorted in non-decreasing order) Sample Input 1 3 2 3 5 Sample Output 1 4 3 5 Explanation For index 0 (value 2): |2-2| + |2-3| +