1、用双重循环逐个遍历(超时)
2、用list B的append和remove函数(超时)
3、用dict B(AC)
class Solution:
# @param A, a list of integer
# @return an integer
def singleNumber(self, A):
B = {}
for i in A:
if i not in B:
B[i] = 1
else:
B[i] = 2
for i in B:
if B[i] == 1:
ret = i
break
return ret