You are given an integer array nums of length n and an integer k.
Calculate the sum of the k largest elements in nums and the sum of the k smallest elements in nums.
Return the absolute difference between these two sums.
Constraints:
n nums.length
nums[i]
k n
You are given an integer array nums of length n and an integer k.
Calculate the sum of the k largest elements in nums and the sum of the k smallest elements in nums.
Return the absolute difference between these two sums.
Constraints:
n nums.length
nums[i]
k n