Skip to content

Commit f108712

Browse files
authored
🐜 Study: [1차] 뉴스 클러스터링 (#95)
1 parent ddfe2d3 commit f108712

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from collections import Counter
2+
3+
def solution(str1, str2):
4+
ext = lambda s: [s[i:i+2] for i in range(len(s)-1)
5+
if (s[i:i+2]).isalpha()]
6+
a = Counter(ext(str1.lower()))
7+
b = Counter(ext(str2.lower()))
8+
itr = sum((a & b).values())
9+
uni = sum((a | b).values())
10+
return 65536 if uni == 0 else int(itr / uni * 65536)

0 commit comments

Comments
 (0)