본문 바로가기
python-algorithm

leetcode 1394. Find Lucky Integer in an Array

by 무적김두칠 2022. 3. 24.

1
2
3
4
5
6
class Solution:
    def findLucky(self, arr: List[int]) -> int:
        ans=-1
        for i in arr:
            if i>ans and arr.count(i)==i :ans=i
        return ans
cs
반응형

댓글