We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6eab721 commit b326914Copy full SHA for b326914
my-submissions/e819.py
@@ -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