Problem
Analysis
Solution
1 2 3 4 5 6 7 8 9 10 11 12 13
|
class : def findDuplicates(self, nums): """ :type nums: List[int] :rtype: List[int] """ ans = [] for num in nums: if nums[abs(num)-1] > 0: nums[abs(num)-1] *= -1 else: ans.append(abs(num)) return ans
|
Link
442. Find All Duplicates in an Array
近期评论