Given two strings s and t, determine if they are isomorphic.
Two strings s and t are isomorphic if the characters in s can be replaced to get t.
All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.
Example 1:
Input: s = "egg", t = "add"
Output: true
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
s = list(s)
t = list(t)
temp = {}
if len(s) != len(t):
return False
for i in range(len(s)):
if s[i] in temp:
if temp[s[i]]!=t[i]:
return False
else:#not in temp
#不在里面但是内容已经有被建过了
if t[i] in temp.values():
return False
else:
temp[s[i]]=t[i]
return True
其他内容待补 等我等我
拜托拜托
这周要来将 [预约页面] 最後的 房间详细资讯 完成!! [标题] (已完成) [预约功能] (已完...
iOS APP iOS Test-Driven Development by Tutorials f...
今天跟朋友在讨论《过度努力》时,朋友说自己对「冒牌者效应」这个词的感觉很复杂 他觉得自己的确有这个词...
一个好的自动补全工具可以让你工作效率翻倍,你不用再去查文件了,自动补全不仅可以告诉你这里有什麽函数可...
今天来弄一个自制的漂亮下拉式选单 首先下拉式选单,会有上面可以按的地方跟下方会弹出来的悬浮按钮 我这...