2148. Count Elements With Strictly Smaller and Greater Elements

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

On This Page

LeetCode problem 2148

class Solution:
    def countElements(self, nums: List[int]) -> int:
        mi, mx = min(nums), max(nums)
        return sum(mi < num < mx for num in nums)