Check Whether Two Strings are Almost Equivalent LeetCode solution in Python

1
from collections import Counter
2

3

4
class Solution:
5
def checkAlmostEquivalent(self, w1: str, w2: str) -> bool:
6
return all(
7
v < 4
8
for v in (
9
(Counter(w1) - Counter(w2)) + (Counter(w2) - Counter(w1))
10
).values()
11
)

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0