[Programmers] - 모의고사 (Level 1)
완전탐색
LEVEL : 1
answers = [1,3,2,4,2]
def solution(answers):
sol1 = [1,2,3,4,5]*2000
sol2 = [2,1,2,3,2,4,2,5]*1250
sol3 = [3,3,1,1,2,2,4,4,5,5]*1000
ans1 = 0
ans2 = 0
ans3 = 0
for i in range(len(answers)):
if sol1[i] == answers[i]:
ans1+=1
if sol2[i] == answers[i]:
ans2+=1
if sol3[i] == answers[i]:
ans3+=1
answer = [ans1, ans2, ans3]
return [x+1 for x in range(len(answer)) if answer[x] == max(answer)]
solution(answers)
[1, 2, 3]
Comments