← All problemsSign in

2465. Number of Distinct Averages

LeetCodeArrayHash TableTwo PointersSortingOpen on judge ↗

You are given a 0-indexed integer array nums of even length. As long as nums is not empty, you must repetitively: - Find the minimum number in nums and remove it. - Find the maximum number in nums and remove it. - Calculate the average of the two removed numbers. The average of two numbers a and b is (a + b) / 2. - For example, the average of 2 and 3 is (2 + 3) / 2 = 2.5. Return the number

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start