Skip to content

Commit 5216540

Browse files
committed
Time: 0 ms (100%), Space: 17.9 MB (27.73%) - LeetHub
1 parent af31ea0 commit 5216540

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
class Solution:
2+
def areAlmostEqual(self, s1: str, s2: str) -> bool:
3+
if s1==s2 :
4+
return True
5+
c=0
6+
s=set()
7+
d=set()
8+
n=min(len(s1),len(s2))
9+
for i in range(n) :
10+
if s1[i] != s2[i] :
11+
c +=1
12+
s.add(s1[i])
13+
d.add(s2[i])
14+
if c > 2 :
15+
return False
16+
return s==d

0 commit comments

Comments
 (0)