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):
print (5%3)
for i in range(len(seq)):
if seq.count(seq[i])%2==1:
return seq[i]'알고리즘 문제 > CodeWar' 카테고리의 다른 글
| Write Number in Expanded Form (1) | 2022.09.21 |
|---|---|
| Vowel Count (1) | 2022.09.21 |
| Persistent Bugger (0) | 2022.09.21 |
| String ends with? (0) | 2022.09.20 |
| Sum of odd numbers (0) | 2022.09.20 |