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
}
相关推荐
小羊在睡觉6 小时前
力扣84. 柱状图中最大的矩形
后端·算法·leetcode·golang·go
sheeta19987 小时前
LeetCode 每日一题笔记 日期:2026.05.29 题目:3300. 最小元素
笔记·leetcode
_日拱一卒7 小时前
LeetCode:994腐烂的橘子
java·数据结构·算法·leetcode·深度优先
小白兔奶糖ovo11 小时前
【Leetcode】231. 2的幂
linux·算法·leetcode
过期动态12 小时前
【LeetCode 热题 100】接雨水
java·数据结构·算法·leetcode·职场和发展
ruxingli15 小时前
Golang iota详解
开发语言·后端·golang
圣保罗的大教堂16 小时前
leetcode 3300. 替换为数位和以后的最小元素 简单
leetcode
sheeta199816 小时前
LeetCode 每日一题笔记 日期:2026.05.27 题目:3121. 统计特殊字母的数量 II
笔记·算法·leetcode
Tisfy16 小时前
LeetCode 3300.替换为数位和以后的最小元素:一次遍历
数学·算法·leetcode·模拟
暗冰ཏོ17 小时前
Go 语言从入门到后端项目实战完整指南
开发语言·后端·golang·go·go语言