-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1.py
More file actions
30 lines (22 loc) · 699 Bytes
/
1.py
File metadata and controls
30 lines (22 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//프로그래머스 신고결과 받기 문제
def solution(id_list, report, k):
reportHash = {}
resultHash = {}
for r in report:
user, bad = r.split()
if user not in reportHash:
reportHash[user] = set()
reportHash[user].add(bad)
if bad not in resultHash:
resultHash[bad] = set()
resultHash[bad].add(user)
answer = [0 for _ in range(len(id_list))]
for i in range(len(id_list)):
user = id_list[i]
if user not in reportHash:
continue
for bad in reportHash[user]:
if len(resultHash[bad]) >=k:
answer[i] +=1
answer = []
return answer