Skip to content

Commit

Permalink
isomorphic string
Browse files Browse the repository at this point in the history
  • Loading branch information
sujin-sreekumaran committed Jan 31, 2024
1 parent 9fce609 commit d71ad02
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions problems/Array/leetcode_205.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 d71ad02

Please sign in to comment.