Skip to content

Commit a1b0fcd

Browse files
committed
Time: 68 ms (67.82%), Space: 14.2 MB (45.94%) - LeetHub
1 parent ff0f6ed commit a1b0fcd

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
classSolution:
2+
defisIsomorphic(self, s: str, t: str) ->bool:
3+
mapOfSToT={}
4+
mapOfTToS={}
5+
forchar1, char2inzip(s,t):
6+
if (char1notinmapOfSToT) and (char2notinmapOfTToS):
7+
mapOfSToT[char1] =char2
8+
mapOfTToS[char2] =char1
9+
if (mapOfSToT.get(char1) !=char2) or (mapOfTToS.get(char2) !=char1):
10+
returnFalse
11+
12+
returnTrue
13+

0 commit comments

Comments
(0)