技术栈

Golang | Leetcode Golang题解之第205题同构字符串

__AtYou__2024-07-01 15:50

题目:

题解:

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
}
上一篇:Vue3注册局部组件和全局组件
下一篇:web基础及http协议
相关推荐
pixcarp
20 小时前
知识库系统的内容资产闭环怎么设计
服务器·数据库·后端·golang
张忠琳
1 天前
【Go 1.26.4】Golang Select 深度解析
开发语言·后端·golang
提笔了无痕
1 天前
如何用Go实现整套RAG流程
开发语言·后端·golang
一只齐刘海的猫
1 天前
【Leetcode】找到字符串中所有字母异位词
算法·leetcode·职场和发展
wlsh15
1 天前
Go 错误处理
golang
geovindu
1 天前
go: Generators Pattern
开发语言·后端·设计模式·golang·生成器模式
凌波粒
1 天前
LeetCode--108.将有序数组转换为二叉搜索树(二叉树)
算法·leetcode·职场和发展
兰令水
1 天前
leecodecode【面试150】【2026.6.13打卡-java版本】
java·算法·leetcode
临沂堇
1 天前
刷题日志 | Leetcode Hot 100 哈希
算法·leetcode·哈希算法
Navigator_Z
1 天前
LeetCode //C - 1096. Brace Expansion II
c语言·算法·leetcode
热门推荐
012026年6月AI行业全景:从百模大战到Agent元年,这30天发生了什么?022026 AI 编程工具终极实战指南:Cursor vs Claude Code vs Copilot,开发者该怎么选?032026 年 AI 编程工具终极横评:Cursor vs Claude Code vs Copilot vs Windsurf04HTTP 与 HTTPS 的区别:从原理到实战详解05【AI】2026 年具身智能模型和世界模型总结06GitHub 镜像站点07上线仅72小时被强制下架:Claude Fable 5 的短命08AI科技热点日报 | 2026年6月1日09Claude Code、Codex、Cursor三分天下:2026年AI编程Agent生态全景剖析10Codex 下载安装指南:Windows 和 macOS 官方版下载