205. Isomorphic Strings

xiaoxiao2021-02-28  109

class Solution(object):     def isIsomorphic(self, s, t):         """         :type s: str         :type t: str         :rtype: bool         """         aDic={}         bDic={}         for i in range(len(s)):             a=aDic.get(s[i])             b=bDic.get(t[i])             if not a and not b:                 aDic[s[i]]=t[i]                 bDic[t[i]]=s[i]             elif a!=t[i] and b!=s[i]:                 return False         return True
转载请注明原文地址: https://www.6miu.com/read-59145.html

最新回复(0)