zoukankan      html  css  js  c++  java
  • 1491. Average Salary Excluding the Minimum and Maximum Salary

    Given an array of unique integers salary where salary[i] is the salary of the employee i.

    Return the average salary of employees excluding the minimum and maximum salary.

    求(total - min -max) / (n - 2)

    class Solution(object):
        def average(self, salary):
            """
            :type salary: List[int]
            :rtype: float
            """
            total = 0
            max_value = salary[0]
            min_value = salary[0]
            for s in salary:
                total += s
                max_value = max(max_value, s)
                min_value = min(min_value, s)
            total = total - max_value - min_value
            return total / float(len(salary) - 2)
                
  • 相关阅读:
    监听
    用户管理
    oracle网络
    实例 参数
    存储管理
    oracle 体系
    实例
    修改
    集合操作
    17.08.18
  • 原文地址:https://www.cnblogs.com/whatyouthink/p/13207463.html
Copyright © 2011-2022 走看看