We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1e9e319 commit 082d637Copy full SHA for 082d637
1 file changed
python/leetcode/twostring.py
@@ -0,0 +1,6 @@
1
+class Solution:
2
+ def checkAlmostEquivalent(self, word1: str, word2: str) -> bool:
3
+ A = [0] * 26
4
+ for char in word1: A[ord(char) - ord("a")] += 1
5
+ for char in word2: A[ord(char) - ord("a")] -= 1
6
+ return not any ([(f < -3 or f > 3) for f in A])
0 commit comments