Skip to content

Commit

Permalink
Merge pull request neetcode-gh#1355 from sezanhaque/205
Browse files Browse the repository at this point in the history
Create: 205-Isomorphic-Strings.py
  • Loading branch information
Ahmad-A0 authored Nov 2, 2022
2 parents 9dfd521 + db52261 commit 02795ef
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/205-Isomorphic-Strings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
mapST, mapTS = {}, {}

for c1, c2 in zip(s, t):
if (c1 in mapST and mapST[c1] != c2) or (c2 in mapTS and mapTS[c2] != c1):
return False
mapST[c1] = c2
mapTS[c2] = c1

return True

0 comments on commit 02795ef

Please sign in to comment.