https://programmers.co.kr/learn/courses/30/lessons/92334
코딩테스트 연습 - 신고 결과 받기
문제 설명 신입사원 무지는 게시판 불량 이용자를 신고하고 처리 결과를 메일로 발송하는 시스템을 개발하려 합니다. 무지가 개발하려는 시스템은 다음과 같습니다. 각 유저는 한 번에 한 명의
programmers.co.kr
def solution(id_list, report, k):
answer = [0] * len(id_list)
report_set = set(report)
re_dic = {}
for re in report_set:
re_s = re.split()
if re_s[1] in re_dic:
re_dic[re_s[1]] += 1
else:
re_dic[re_s[1]] = 1
over_k_dic = dict(filter(lambda x:x[1]>=k, re_dic.items()))
for re in report_set:
re_s = re.split()
if re_s[1] in over_k_dic:
answer[id_list.index(re_s[0])] += 1
return answer
'파이썬 코딩테스트 > 프로그래머스' 카테고리의 다른 글
프로그래머스 / 크레인 인형 뽑기 / 파이썬 (0) | 2022.02.24 |
---|---|
프로그래머스 / 키패드 누르기 / 파이썬 (0) | 2022.02.24 |
프로그래머스 / 수식 최대화 / 파이썬 (0) | 2022.02.18 |
프로그래머스 / 주차 요금 계산 / 파이썬 (0) | 2022.02.18 |
프로그래머스 / 메뉴 리뉴얼 / 파이썬 (0) | 2022.02.17 |