본문 바로가기

IT/코딩테스트

[Leetcode] 961. N-Repeated Element in Size 2N Array

728x90

https://leetcode.com/problems/n-repeated-element-in-size-2n-array

class Solution:
    def repeatedNTimes(self, nums: List[int]) -> int:

        for i in nums:
            if nums.count(i) > 1:
                return i

        return -1
728x90