本文共 280 字,大约阅读时间需要 1 分钟。
一个整型数组里除了两个数字之外,其他的数字都出现了偶数次。请写程序找出这两个只出现一次的数字。
class Solution: # 返回[a,b] 其中ab是出现一次的两个数字 def FindNumsAppearOnce(self, array): l = [] for i in array: if array.count(i) == 1 and i not in l: l.append(i) return l
转载地址:http://wbfab.baihongyu.com/