mirror of
https://gitlab.com/mfocko/CodeWars.git
synced 2024-11-09 19:19:07 +01:00
17 lines
274 B
Python
17 lines
274 B
Python
|
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
|