프로그래머스 모의고사

yoonene·2021년 12월 17일
0

알고리즘

목록 보기
15/62
def solution(answers):
    spz1 = [1,2,3,4,5]
    spz2 = [2,1,2,3,2,4,2,5]
    spz3 = [3,3,1,1,2,2,4,4,5,5]
    
    [1,2,3,4,5,6,7,8,9,10]
    
    scores = [0, 0, 0]
    n = len(answers)
    
    for i in range(len(answers)):
        if spz1[i%5] == answers[i]:
            scores[0] += 1
        if spz2[i%8] == answers[i]:
            scores[1] += 1
        if spz3[i%10] == answers[i]:
            scores[2] += 1
    
    best = max(scores)
    result = []
    
    for i in range(3):
        if best == scores[i]:
            result.append(i+1)
            
    return result
profile
NLP Researcher / Information Retrieval / Search

0개의 댓글