1619. Mean of Array After Removing Some Elements

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1619

class Solution:
    def trimMean(self, arr: List[int]) -> float:
        n = len(arr)
        start, end = int(n * 0.05), int(n * 0.95)
        arr.sort()
        t = arr[start:end]
        return round(sum(t) / len(t), 5)