Skip to content

Commit b326914

Browse files
authored
Create e819.py
1 parent 6eab721 commit b326914

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

my-submissions/e819.py

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution:
2+
def mostCommonWord(self, paragraph: str, banned: List[str]) -> str:
3+
cnt = Counter([x.lower() for x in re.findall('[A-Za-z]+', paragraph)])
4+
banned = set(banned)
5+
output = sorted([x for x in cnt.keys() if x not in banned], key=lambda x: cnt[x])
6+
return output[-1]

0 commit comments

Comments
 (0)