Count Common Words With One Occurrence LeetCode solution in Python

1
class Solution:
2
def countWords(self, words1: List[str], words2: List[str]) -> int:
3
count = Counter(words1 + words2)
4
return len(
5
[
6
word
7
for word in count
8
if count[word] == 2 and word in words1 and word in words2
9
]
10
)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0