2148. Count Elements With Strictly Smaller and Greater Elements (Easy) - TengnanYao/daily_leetcode GitHub Wiki

class Solution:
    def countElements(self, nums: List[int]) -> int:
        m, n = max(nums), min(nums)
        result = 0
        for num in nums:
            if num != m and num != n:
                result += 1
        return result