首先练习一下python,使用collection的Counter
查看代码
class Solution:
def findDuplicate(self, nums: List[int]) -> int:
a=Counter(nums)
for i in a:
if a[i] >= 2:
return i
return 1
标签:return,nums,重复,Counter,List,寻找,Solution,int,287
来源: https://www.cnblogs.com/jozon/p/15730508.html