Practice Number of Distinct Averages
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Until the even-length nums array is empty, remove its smallest and largest remaining values and record their arithmetic mean. Any tied occurrence can be removed. Return the number of distinct means recorded.
Source: Number of Distinct Averages on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
nums = [4,1,4,0,3,5]
Output
2
# Example 2
Input
nums = [1,100]
Output
1
Constraints
2 <= nums.length <= 100
nums.length is even.
0 <= nums[i] <= 100
Related LeetCode Problems
Practice more problems similar to Number of Distinct Averages.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.