205. Isomorphic Strings
solution
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
dict = {}
if len(s) != len(t):
return False
for i, j in zip(s, t):
if i != j:
if i not in dict:
dict[i] = j
else:
if dict[i] != j:
return False
else:
dict[i] = j
return TrueLast updated