반응형
def solution(lottos, win_nums):
rank_obj = { '0' : 6, '1' : 6, '2': 5 , '3' : 4, '4' : 3, '5' : 2 , '6' : 1 }
result = []
zero_count = 0
check_count = 0
for lotto in lottos:
if lotto == 0:
zero_count += 1
if lotto in win_nums:
check_count += 1
if zero_count == 0:
return [rank_obj[str(check_count)], rank_obj[str(check_count)]]
elif zero_count == 6:
return [rank_obj[str(zero_count)], zero_count]
else:
max_count = zero_count+check_count
return [rank_obj[str(max_count)], rank_obj[str(check_count)]]
반응형
'삽집하는 개발들 > 알고리즘' 카테고리의 다른 글
[49일차][Lv2][프로그래머스][12939]최댓값과 최솟값 (4) | 2023.08.29 |
---|---|
[49일차][Lv1][프로그래머스][132267]콜라 문제 (0) | 2023.08.29 |
[48일차][Lv1][프로그래머스][2018 KAKAO BLIND RECRUITMENT[1차]][17682] 다트 게임 (2) | 2023.08.28 |
[47일차][Lv1][프로그래머스][120869]외계어 사전 (4) | 2023.08.24 |
[46일차][프로그래머스][136798]기사단원의 무기 (2) | 2023.08.22 |