https://programmers.co.kr/learn/courses/30/lessons/77484
LEVEL 1
틀린 내용 지적 환영합니다
def solution(lottos, win_nums):
grade = {6: 1, 5: 2, 4: 3, 3: 4, 2: 5, 1: 6, 0: 6}
wins = set(win_nums)
correct = 0
zero = 0
for lotto in lottos:
if lotto in wins:
correct += 1
elif lotto == 0:
zero += 1
return [grade[correct + zero], grade[correct]]
O(n)
10분 이내 (안 재봄)
def solution(lottos, win_nums):
grade = [6, 6, 5, 4, 3, 2, 1]
correct = len(set(win_nums) & set(lottos))
zero = lottos.count(0)
return [grade[correct + zero], grade[correct]]
O(n)