Find the only unique element from list
x = [1, 2, 3, 1, 3, 5, 2, 5, 7]
# Way 1 - HashMap
d = {}
for e in x:
if e in d:
# Removes when found twice
del d[e]
else:
# Inserts when found once
d[e] = True
k = list(d.keys())
print(k[0])
# Way 2 - Counter
from collections import Counter
c = Counter(x)
filtered = {k:v for k,v in c.items() if v == 1}
last = list(filtered.keys())
print('Counter after filer ', last[0])
# Way 3 - XOR
t = 0
for e in x:
t ^= e
print('After XOR ', t)