[Codility/Lesson/Arrays]OddOccurrenceInArray

zzarbttoo·2021년 8월 5일
0

코딜리티

목록 보기
3/29

대충 홀수번 나온 숫자를 찾는 문제라고 한다

import collections

def solution(A):

    count = collections.defaultdict(int)

    for i in A:
        count[i] += 1

    for key, value in count.items():
        if value % 2 != 0:
            return key

    
A = [9, 3, 9, 3, 9, 7, 9]
A = []
print(solution(A))

결과는 여기에

profile
나는야 누워있는 개발머신

0개의 댓글