1.题目:
In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated...例一:
Input: [1,2,3,3]
Output: 3
例二:
Input: [2,1,2,5,3,2]
Output: 2
注意:
4 <= A.length <= 10000
0 <= A[i...] < 10000
A.length is even
我的解法:
class Solution:
def repeatedNTimes(self, A: List[int]) -> int:...[i]
Runtime: 48 ms, faster than 88.03% of Python3 online submissions for N-Repeated Element in Size 2N...1))
有重复的和减去没有重复的和 再除以长度除以2再减1就是重复的项。