문제 링크
https://school.programmers.co.kr/learn/courses/30/lessons/92334
코드 (python)
def solution(id_list, report, k):
answer = []
report_dict = {}
for id in id_list:
report_dict[id] = []
answer.append(0)
for r in report:
report_person = r.split(" ")[0]
reported_person = r.split(" ")[1]
if report_person in report_dict[reported_person]:
pass
else:
report_dict[reported_person].append(
report_person)
for key, value in report_dict.items():
if len(value) >= k:
for val in value:
answer[id_list.index(val)] += 1
return answer