You are given an integer array nums of even length.
As long as nums is not empty, perform the following operation:
Find and remove the minimum value in nums.
Find and remove the maximum value in nums.
Compute the average of the pair of removed numbers.
Return the total number of distinct averages obtained from this process.
Note: The average of two numbers
and is computed as .
Constraints:
nums.length
nums.length is even.
nums[i]
You are given an integer array nums of even length.
As long as nums is not empty, perform the following operation:
Find and remove the minimum value in nums.
Find and remove the maximum value in nums.
Compute the average of the pair of removed numbers.
Return the total number of distinct averages obtained from this process.
Note: The average of two numbers
and is computed as .
Constraints:
nums.length
nums.length is even.
nums[i]