1619. Mean of Array After Removing Some Elements

Обновлено: 2024-03-12
1 мин
[]

Содержание

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)