Leetcode 1210 Solution

This article provides solution to leetcode question 1210 (mean-of-array-after-removing-some-elements).

https://leetcode.com/problems/mean-of-array-after-removing-some-elements

Solution

class Solution:
    def trimMean(self, arr: List[int]) -> float:
        arr.sort()
        
        bound = len(arr) // 20
        
        i = bound
        
        return sum(arr[bound:-bound]) / len(arr[bound:-bound])