Given a list of integers nums sorted in non-decreasing order and an integer c, return a list containing abs(x - c) for every x in nums, sorted in non-decreasing order. Do not call sort or sorted.
Examples
Input: nums = [-5, -1, 2, 3, 9], c = 1
Output: [1, 2, 2, 6, 8]
Explanation: the distances are 6, 2, 1, 2, 8.
Input: nums = [1, 2, 3], c = 10
Output: [7, 8, 9]
Constraints
0 <= len(nums) <= 10**5- Target: O(n) time, O(1) extra space beyond the output list.
Goals
- Recognise that a sorted input becomes two sorted halves under a V-shaped transform
- Merge from the outside in, or from the inside out, without sorting