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
}
相关推荐
Tisfy29 分钟前
LeetCode 0020.有效的括号:栈匹配
算法·leetcode·字符串·题解·括号匹配
Navigator_Z1 小时前
LeetCode //C - 1276. Number of Burgers with No Waste of Ingredients
c语言·算法·leetcode
想吃火锅10051 小时前
【leetcode】189.轮转数组js
开发语言·javascript·leetcode
念何架构之路1 小时前
go-grpc服务端调用
开发语言·后端·golang
茉莉玫瑰花茶3 小时前
GO [ 单元测试 ]
golang·单元测试·log4j
All for pursuit.3 小时前
【贪心-2】253.会议室 II
数据结构·c++·算法·leetcode
喵了几个咪4 小时前
Go 写业务,Rust 扛底盘:一套可落地的混合架构
微服务·架构·golang·rust·多租户·gowind·rushwind
ttwuai4 小时前
Golang Web后台管理框架推荐:Gin、GoFrame与数据面板项目怎么分
前端·golang·gin
魏码不凡4 小时前
Go 编译报错:undefined: webp.Encode 问题排查与解决
开发语言·后端·golang
tachibana26 小时前
与其他语言相比,使用 Go 有什么好处?
开发语言·后端·golang·go