1394. Find Lucky Integer in an Array

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

Содержание

LeetCode problem 1394

class Solution:
    def findLucky(self, arr: List[int]) -> int:
        cnt = Counter(arr)
        res = -1
        for x, v in cnt.items():
            if x == v and res < x:
                res = x
        return res