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
}
相关推荐
tachibana22 小时前
hot100 回文链表(234)
java·网络·数据结构·leetcode·链表
wabs6664 小时前
关于动态规划【力扣1143.最长公共子序列的思考】
算法·leetcode·动态规划
剑挑星河月5 小时前
54.螺旋矩阵
java·算法·leetcode·矩阵
笨笨没好名字6 小时前
Leetcode刷题python3版第一周(下)
linux·算法·leetcode
想你依然心痛6 小时前
AtomCode在后端开发中的实战体验:Go微服务从零搭建
开发语言·微服务·golang
王老师青少年编程7 小时前
2026年6月GESP真题及题解(C++五级):排排坐
c++·题解·真题·gesp·五级·2026年6月·排排坐
开发小程序的之朴8 小时前
认识安企CMS - 系统概述
nginx·golang·系统架构
雨师@8 小时前
go语言项目--实例化(图书管理)--005
开发语言·后端·golang
Vect__8 小时前
Go 数据结构 slice 深度剖析
开发语言·数据结构·golang
geovindu8 小时前
go: Functional Options Pattern
开发语言·后端·设计模式·golang·函数式选项模式’·惯用法模式