class Solution:
def FindNumsAppearOnce(self , nums: List[int]) -> List[int]:
# write code here
# 直接写返回res,第一次出现时加入,若发现已经存在删除好了,
hash = {}
for i in range(len(nums)):
if nums[i] not in hash:
hash[nums[i]]=1
else:
hash[nums[i]]+=1
res = [i for i in hash if hash[i]==1]
# sort()方法直接对原列表进行排序,返回为空
res.sort()
return res

京公网安备 11010502036488号