Skip to content

Instantly share code, notes, and snippets.

@atul-chaudhary
Created September 24, 2019 09:03
Show Gist options
  • Save atul-chaudhary/0d150895ea64b4b08d36972e803c444c to your computer and use it in GitHub Desktop.
Save atul-chaudhary/0d150895ea64b4b08d36972e803c444c to your computer and use it in GitHub Desktop.
program7:- leetcode 205 Isomorphic strings.
#program is not 100% correct faling in some test cases.
# i am working on it and efficiency can also be increased
class Solution:
def isIsomorphic(self, s, t):
d = {}
if(s==t):
return True
else:
for i in range(len(s)):
if(s[i] in d):
x=d[s[i]]
if(x!=t[i]):
return False
else:
return True
else:
d[s[i]]=t[i]
print(d)
else:
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment