class Solution:
def findDuplicates(self, nums: List[int]) -> List[int]:
s=set()
results=[]
for v in nums:
if v in s:
results.append(v)
s.add(v)
return results
442. Find All Duplicates in an Array
最新推荐文章于 2024-11-01 15:19:21 发布