Skip to content

Commit f644b7b

Browse files
Nursultan AmirNursultan Amir
Nursultan Amir
authored and
Nursultan Amir
committed
campusCup
1 parent e7a4e11 commit f644b7b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

codesignal/02-dropbox-campusCup.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import collections
2+
def campusCup(emails):
3+
d = collections.defaultdict(int)
4+
for em in emails:
5+
d[em.split('@')[1]] += 20
6+
7+
8+
for em, pts in d.items():
9+
pts //= 100
10+
if pts == 4: pts = 3
11+
if pts > 5: pts = 5
12+
d[em] = -pts
13+
14+
att_sorted = sorted([[pts, em] for em, pts in d.items()])
15+
return [em for pts, em in att_sorted]

0 commit comments

Comments
 (0)