1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-09-19 22:16:57 +02:00
CodeWars/6kyu/find_the_unique_number/solution.py

17 lines
274 B
Python
Raw Normal View History

def find_uniq(arr):
a = arr[0]
count_a = 1
b = None
count_b = 0
for e in arr[1:]:
if e != a:
count_b += 1
b = e
else:
count_a += 1
if count_a < count_b:
return a
else:
return b