# -*- coding:utf-8 -*- class Solution: # 返回[a,b] 其中ab是出现一次的两个数字 def FindNumsAppearOnce(self, array): # write code here results={} for elem in array: if elem not in results: results[elem]=1 else: results[elem]+=1 output=[] for k,v in results.items(): if v==1: output.append(int(k)) if len(output)==2: break return output
python数组中只出现一次的数字
最新推荐文章于 2021-04-14 20:16:02 发布