思考:此题比较简单,和第448题思想一致。
# 442 class Solution(object): def findDuplicates(self, nums): """ :type nums: List[int] :rtype: List[int] """ count = [0 for i in range(0,len(nums))] for i in nums: count[i-1] += 1 return_list = [] for i,num in enumerate(count): if num == 2: return_list.append(i+1) return return_list a = Solution() a.findDuplicates([4,3,2,7,8,2,3,1])