Golang | Leetcode Golang题解之第205题同构字符串

题目:

题解:

Go 复制代码
func isIsomorphic(s, t string) bool {
    s2t := map[byte]byte{}
    t2s := map[byte]byte{}
    for i := range s {
        x, y := s[i], t[i]
        if s2t[x] > 0 && s2t[x] != y || t2s[y] > 0 && t2s[y] != x {
            return false
        }
        s2t[x] = y
        t2s[y] = x
    }
    return true
}
相关推荐
longlongzihan13 小时前
LeetCode 5. 最长回文子串:从暴力匹配到中心扩展的思维演进
c++·算法·leetcode
苦瓜打怪兽13 小时前
leetcode 热题100(11. 盛最多水的容器)
python·算法·leetcode
microrain16 小时前
同一个寄存器,四种读法:SagooIoT Modbus 驱动的字节序、宽度与功能码
物联网·golang·开源·sagooiot
JWASX18 小时前
Java 转 go 学习 - 并发编程(2)
学习·golang
All for pursuit.18 小时前
【回溯-6】79.单词搜索
数据结构·c++·算法·leetcode
Navigator_Z18 小时前
LeetCode //C - 1281. Subtract the Product and Sum of Digits of an Integer
c语言·算法·leetcode
ttwuai20 小时前
Go开源后台管理系统推荐:README、源码和License应该怎么验
开发语言·golang·开源
JWASX20 小时前
Java 转 go 学习 - 并发编程(1)
学习·golang
旖旎夜光21 小时前
LeetCode 1576: 替换所有的问号(模拟) —— 题解
c++·学习·算法·leetcode·力控
longlongzihan21 小时前
回溯法详解:LeetCode 46. 全排列
算法·leetcode·回溯