【LEETCODE】205-Isomorphic Strings
来源:互联网 发布:淘宝发错货还用退回吗 编辑:程序博客网 时间:2024/06/05 00:11
Given two strings s and t, determine if they are isomorphic.
Two strings 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.
For example,
Given "egg","add", return true.
Given "foo","bar", return false.
Given "paper","title", return true.
Note:
You may assume both s andt have the same length.
class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ sdict={} tdict={} for i,j in zip(s,t): if i not in sdict: sdict[i]=j if j not in tdict: tdict[j]=i if sdict[i]!=j or tdict[j]!=i: return False return True
0 0
- LeetCode 205 - Isomorphic Strings
- [LeetCode 205]Isomorphic Strings
- LeetCode 205-Isomorphic Strings
- leetcode 205: Isomorphic Strings
- leetcode 205 Isomorphic Strings
- LeetCode 205:Isomorphic Strings
- leetcode-205 Isomorphic Strings
- Isomorphic Strings - LeetCode 205
- Isomorphic Strings leetcode 205
- leetcode 205:Isomorphic Strings
- leetcode-205 Isomorphic Strings
- Isomorphic Strings(leetcode 205)
- leetcode[205]:Isomorphic Strings
- leetcode-205-Isomorphic Strings
- leetcode 205: Isomorphic Strings
- leetcode: (205) Isomorphic Strings
- [LeetCode 205] Isomorphic Strings
- Leetcode----205Isomorphic Strings
- 轻松学习JavaScript十七:JavaScript的BOM学习(二)
- PHP访问MySQL几种方法
- Majority Element I&II | Leetcode
- 关于微信原生支付(扫码支付)的两种支付模式的理解和比较...
- ListView子布局样式有多个的处理
- 【LEETCODE】205-Isomorphic Strings
- OC学习_3_关于封装
- HDU 1257 最少拦截系统 贪心
- php-简单计算器
- zzulioj--1807--小明在努力(递归)
- Linux VI常用命令
- 九宫格效果一
- [Android][Button]Button注册点击事件的4种方法
- 第十四周(项目一)--数据结构-递归的折半查找