def correct_counter(supoza, answers):
cnt=0
for i in range(len(answers)):
if answers[i] == supoza[i%len(supoza)]: cnt+=1
return cnt
def solution(answers):
supoza1 = [1, 2, 3, 4, 5]
supoza2 = [2, 1, 2, 3, 2, 4, 2, 5]
supoza3 = [3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
cnt=[]
cnt.append(correct_counter(supoza1,answers))
cnt.append(correct_counter(supoza2,answers))
cnt.append(correct_counter(supoza3,answers))
answer = []
for i in range(len(cnt)):
if cnt[i]==max(cnt):
answer.append(i+1)
return answer
'Programming > Programmers' 카테고리의 다른 글
[프로그래머스/Python] 타겟넘버(DFS) (0) | 2020.12.16 |
---|---|
[프로그래머스/Python] K번째수(정렬) (0) | 2020.12.16 |
[프로그래머스/Python] 카펫(소인수분해) (0) | 2020.12.16 |
[프로그래머스/Python] 완주하지 못한 선수(해쉬) (0) | 2020.12.16 |
[프로그래머스/Python] 소수찾기(소수/순열/중복제거) (0) | 2020.12.16 |