Skip to content

Commit d849522

Browse files
committed
0418
1 parent d305e66 commit d849522

File tree

2 files changed

+82
-99
lines changed

2 files changed

+82
-99
lines changed

.idea/workspace.xml

Lines changed: 57 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from itertools import combinations
2+
3+
4+
def solution(orders, course):
5+
answer = []
6+
7+
for k in course:
8+
cnt = {}
9+
for o in orders:
10+
#sorted를 통해서 WX, XW가 같은 것으로 인식되게끔 정렬을 해줘야함!! -> 핵심
11+
result = list(combinations(sorted(o), k))
12+
for r in result:
13+
txt = ''.join(map(str, r))
14+
15+
if txt in cnt.keys():
16+
cnt[txt] += 1
17+
else:
18+
cnt[txt] = 1
19+
20+
for k, v in cnt.items():
21+
if max(cnt.values()) > 1 and cnt[k] == max(cnt.values()):
22+
answer.append(k)
23+
answer = sorted(answer)
24+
25+
return answer

0 commit comments

Comments
 (0)