Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions 72411_py_jy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from itertools import combinations
from collections import Counter

def solution(orders, course):
answer = []
for cs in course:
tmp = []
for od in orders:
cb = combinations(sorted(od), cs)
tmp += cb
ct = Counter(tmp)
if len(ct) != 0 and max(ct.values()) != 1:
answer += [''.join(ff) for ff in ct if
ct[ff] == max(ct.values())]
answer = sorted(answer)
return answer