Search
⌘K
Get Premium
Leetcode 2465. Number of Distinct Averages
Repeatedly pair and remove the current minimum and maximum from an even-length array, compute each pair's average (a+b)/2, and return how many distinct averages occur. Key observation: after sorting, these averages are just the distinct values of symmetric pair sums (nums[i]+nums[n-1-i]).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.