给定两个字符串s和t,判断它们是否是同构的。
如果字符串s可以通过字符替换的方式得到字符串t,则称s和t是同构的。
class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
return map(s.find,s) == map(t.find,t)
给定两个字符串s和t,判断它们是否是同构的。
如果字符串s可以通过字符替换的方式得到字符串t,则称s和t是同构的。
class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
return map(s.find,s) == map(t.find,t)