https://programmers.co.kr/learn/courses/30/lessons/42840
오.. 노가다로 풀었다.
level1
def solution(answers):
answer = []
n = [0,0,0]
num1 = [1,2,3,4,5] * 2000
num2 = [2,1,2,3,2,4,2,5] * 1250
num3 = [3,3,1,1,2,2,4,4,5,5] * 1000
for i in range(len(answers)):
ans = answers[i]
if ans == num1[i]: n[0] +=1
if ans == num2[i]: n[1] +=1
if ans == num3[i]: n[2] +=1
big = sorted(n)[-1]
for i in range(len(n)):
if n[i] == big:
answer.append(i+1)
return answer
'algorithm > python' 카테고리의 다른 글
hackerrank/Hash Tables/Ransom Note (0) | 2020.03.09 |
---|---|
hackerrank/String/Sherlock and the Valid String (0) | 2020.03.08 |
프로그래머스/힙/더 맵게 (0) | 2020.03.07 |
프로그래머스/스택,큐/탑 (0) | 2020.03.07 |
프로그래머스/정렬/H-Index (0) | 2020.03.07 |