정답
def solution(lottos, win_nums):
answer = []
min_match = 0
rank = {6:1, 5:2, 4:3, 3:4, 2:5, 1:6, 0:6}
idx = 0
lottos.sort(reverse = True)
win_nums.sort(reverse = True)
for i in lottos:
if i == 0:
break
for j in win_nums:
if i == j:
min_match = min_match + 1
idx = idx + 1
max_match = min_match + len(lottos) - idx
answer.append(rank[max_match])
answer.append(rank[min_match])
return answer
'Algorithm' 카테고리의 다른 글
옹알이 (2) / 프로그래머스 (0) | 2025.03.11 |
---|---|
기사단원의 무기 / 프로그래머스 (0) | 2025.03.04 |
덧칠하기 / 프로그래머스 (0) | 2025.03.03 |
소수 만들기 / 프로그래머스 (0) | 2025.03.01 |
모의고사 / 프로그래머스 (0) | 2025.02.28 |