Skip to content

Latest commit

 

History

History
15 lines (13 loc) · 348 Bytes

1619.md

File metadata and controls

15 lines (13 loc) · 348 Bytes

1619. Mean of Array After Removing Some Elements

Solution 1 (time O(n), space O(n))

class Solution(object):
    def trimMean(self, arr):
        """
        :type arr: List[int]
        :rtype: float
        """
        arr.sort()
        n = len(arr)
        return sum(arr[n // 20: -n // 20]) / float(n * 0.9)