剑指offer python版 数组中只出现一次的两个数字
def aa(nums): hashes={} for s in nums: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 for s in nums: if hashes[s]==1: print (s) return print(aa([1,2,3,3,3,4,5,5]))
def aa(nums): hashes={} for s in nums: hashes[s]=hashes[s]+1 if hashes.get(s) else 1 for s in nums: if hashes[s]==1: print (s) return print(aa([1,2,3,3,3,4,5,5]))