class Solution(object):
def isIsomorphic(self, s, t):
"""
:type s: str
:type t: str
:rtype: bool
"""
sTable={}
tTable={}
for i in xrange(len(s)):
if s[i] not in sTable and t[i] not in tTable :
sTable[s[i]]=i
tTable[t[i]]=i
elif s[i] not in sTable or t[i] not in tTable:
return False
elif sTable[s[i]]!=tTable[t[i]]:
return False
return True
205. Isomorphic Strings
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- GitHub:https://github.com/BadWaka/leet-code-waka 思路 新建四个数...
- 1.描述 Given two strings s and t, determine if they are iso...
- Given two strings s and t, determine if they are isomorph...
- 一、题目 二、解题 输入:两个字符串输出:判断是否可以被完整替换(即相同字母的位置一样,且一一对应) 使用字典储存...
- Given two strings s and t, determine if they are isomorph...