Created
September 24, 2019 09:03
-
-
Save atul-chaudhary/0d150895ea64b4b08d36972e803c444c to your computer and use it in GitHub Desktop.
program7:- leetcode 205 Isomorphic strings.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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