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
}
相关推荐
李燚17 小时前
Eino devops 调试系统源码:GraphCompileCallback 怎么工作(第50篇-E36)
数据库·golang·agent·devops·graphql·aiagent·eino
退休倒计时17 小时前
【每日一题】LeetCode 17. 电话号码的字母组合 TypeScript
算法·leetcode·typescript
临沂堇18 小时前
刷题日志 | LeetCode Hot 100 双指针
算法·leetcode·职场和发展
XWalnut19 小时前
LeetCode刷题 day29
java·算法·leetcode
名字还没想好☜20 小时前
Go 内存逃逸分析:什么时候变量跑到堆上
开发语言·算法·性能优化·golang·go·内存逃逸
小欣加油20 小时前
leetcode1331 数组序号转换
数据结构·c++·算法·leetcode·职场和发展
ttwuai21 小时前
后台管理系统 RBAC 排障:隐藏菜单后接口为什么还能调用
golang
Hesionberger1 天前
动态规划与二分法破解最长递增子序列
java·数据结构·python·算法·leetcode
令狐掌门1 天前
2026华为OD面试题020:日志文件异常检测
算法·leetcode·华为od
Wang's Blog1 天前
Go-Zero框架上手前奏2: 微服务核心要素 —— 拆分、通信与无状态设计
开发语言·微服务·golang