剑指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]))

 

posted @ 2018-10-29 10:45  findtruth123  阅读(199)  评论(0编辑  收藏  举报