DESCRIPTION:
Given an array of integers, find the one that appears an odd number of times.
There will always be only one integer that appears an odd number of times.
Examples
[7] should return 7, because it occurs 1 time (which is odd).
[0] should return 0, because it occurs 1 time (which is odd).
[1,1,2] should return 2, because it occurs 1 time (which is odd).
[0,1,0,1,0] should return 0, because it occurs 3 times (which is odd).
[1,2,2,3,3,3,4,3,3,3,2,2,1] should return 4, because it appears 1 time (which is odd).
def find_it(seq):
for i in seq:
if seq.count(i)%2==1:
return i
print(seq.count(20))
'알고리즘 문제 > CodeWar' 카테고리의 다른 글
Sum of Digits/Digital Root (0) | 2022.09.28 |
---|---|
Stop gninnipS My sdroW! (0) | 2022.09.28 |
Ones and Zeros (0) | 2022.09.28 |
Friend or Foe? (0) | 2022.09.28 |
Reverse Letter (0) | 2022.09.28 |