반응형
https://school.programmers.co.kr/learn/courses/30/lessons/42840
프로그래머스
코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.
programmers.co.kr
def solution(answers):
answer = []
no1=[1, 2, 3, 4, 5]
no2=[2, 1, 2, 3, 2, 4, 2, 5]
no3=[3, 3, 1, 1, 2, 2, 4, 4, 5, 5]
no=[0,0,0]
for i in range(len(answers)):
if answers[i]==no1[i%5]:
no[0]+=1
if answers[i]==no2[i%8]:
no[1]+=1
if answers[i]==no3[i%10]:
no[2]+=1
for i,n in enumerate(no):
if n==max(no):
answer.append(i+1)
return answer
반응형
'코딩테스트 > 프로그래머스' 카테고리의 다른 글
[프로그래머스] lv.1 추억 점수 python (0) | 2023.07.03 |
---|---|
[프로그래머스] lv.1 과일 장수 python (0) | 2023.07.03 |
[프로그래머스] lv.1 덧칠하기 python (0) | 2023.07.03 |
[프로그래머스] lv.1 [1차] 비밀지도 python (0) | 2023.07.03 |
[프로그래머스] lv.1 수박수박수박수박수박수? python (1) | 2023.07.03 |