1491. Average Salary Excluding the Minimum and Maximum Salary
Easy
You are given an array of unique integers salary
where salary[i]
is the salary of the ith
employee.
Return the average salary of employees excluding the minimum and maximum salary. Answers within 10-5
of the actual answer will be accepted.
Example 1:
Example 2:
Constraints:
3 <= salary.length <= 100
1000 <= salary[i] <= 106
All the integers of
salary
are unique.
解題
這題用變數紀錄min和max最後再扣掉時間複雜度應該會比較好,但我選擇先排序,程式看起來比較精簡:
Last updated