2024-05-03发表2025-01-15更新LeetCode每日一题几秒读完 (大约96个字)0次访问1491. 去掉最低工资和最高工资后的工资平均值去掉最低工资和最高工资后的工资平均值 难度: easy 原始链接: https://leetcode.cn/problems/average-salary-excluding-the-minimum-and-maximum-salary 标签: 循环 解法一: 循环go1234567891011func average(salary []int) float64 { minSalary := math.MaxInt maxSalary := math.MinInt sum := 0 for _, num := range salary { sum += num minSalary = min(minSalary, num) maxSalary = max(maxSalary, num) } return float64(sum-minSalary-maxSalary) / float64(len(salary)-2)} 1491. 去掉最低工资和最高工资后的工资平均值https://wuhunyu.top/leetcode/2024/05/average-salary-excluding-the-minimum-and-maximum-salary/index.html作者wuhunyu发布于2024-05-03更新于2025-01-15许可协议#循环