1
0
Fork 0
mirror of https://gitlab.com/mfocko/CodeWars.git synced 2024-11-24 01:31:56 +01:00
CodeWars/6kyu/find_the_unique_number/solution.py

17 lines
274 B
Python
Raw Permalink 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