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
}
相关推荐
鹏北海-RemHusband7 小时前
Go 语言进阶笔记 — 面向 JS/TS 前端开发者
笔记·golang
罗超驿11 小时前
9.LeetCode 209. 长度最小的子数组 | 滑动窗口专题详解
java·算法·leetcode·面试
水蓝烟雨12 小时前
0135. 分发糖果
算法·leetcode
如竟没有火炬12 小时前
乘法表中第K小的数——二分
开发语言·数据结构·python·算法·leetcode·职场和发展·动态规划
诚威_lol_中大努力中15 小时前
Hot-146 LRU(最近最少使用Least Recent Use)缓存
leetcode
x_xbx15 小时前
LeetCode:739. 每日温度
算法·leetcode·职场和发展
Starry-sky(jing)16 小时前
Hermes Agent 接入 Qwen3.7-Max 报 401?OpenCode Go 模型路由源码级排查与修复
开发语言·人工智能·chrome·golang
鹏北海-RemHusband16 小时前
Go 语言基础笔记 — 面向 JS/TS 前端开发者
笔记·golang
圣保罗的大教堂16 小时前
leetcode 3121. 统计特殊字母的数量 II 中等
leetcode
圣保罗的大教堂16 小时前
leetcode 3120. 统计特殊字母的数量 I 简单
leetcode