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
}
相关推荐
ttwuai10 小时前
Cursor 生成 CRUD 后,Go 后台接口别只测 200:JWT、RBAC 和 tenant_id 怎么验
开发语言·后端·golang
闪电悠米16 小时前
力扣hot100-73.矩阵置零-标记数组详解
算法·leetcode·矩阵
microrain17 小时前
从硬编码到热插拔:SagooIoT插件架构如何打破物联网平台的扩展瓶颈
物联网·golang·开源·sagooiot
geovindu18 小时前
go:Backtracking Algorithm
开发语言·后端·算法·golang·回溯算法
qq_4523962318 小时前
第六篇:《并发编程核心:Goroutine 与 Channel》
golang
llwszx19 小时前
【Java/Go后端手撸原生Agent(第五篇):多工具并行调用 + BashTool执行引擎 + Judge证据链升级】
java·后端·golang·状态机·pydantic·agnet·llm-as-judge
FfHUCisI19 小时前
Go语言程序结构 —— 变量、声明与零值机制
golang
过期动态19 小时前
【LeetCode 热题 100】找到字符串中所有字母异位词
java·数据结构·算法·leetcode·职场和发展·rabbitmq
超人不会飞_Jay20 小时前
Go课程2
开发语言·后端·golang
Adios7941 天前
设置交集大小至少为2
数据结构·算法·leetcode