1426. Counting Elements

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

Содержание

LeetCode problem 1426

class Solution:
    def countElements(self, arr: List[int]) -> int:
        cnt = Counter(arr)
        return sum(v for x, v in cnt.items() if cnt[x + 1])