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
}
相关推荐
ん贤21 小时前
Go channel 深入解析
开发语言·后端·golang
逆境不可逃1 天前
LeetCode 热题 100 之 64. 最小路径和 5. 最长回文子串 1143. 最长公共子序列 72. 编辑距离
算法·leetcode·动态规划
yashuk1 天前
Go-Gin Web 框架完整教程
前端·golang·gin
Eward-an1 天前
LeetCode 239. 滑动窗口最大值(详细技术解析)
python·算法·leetcode
一叶落4381 天前
LeetCode 50. Pow(x, n)(快速幂详解 | C语言实现)
c语言·算法·leetcode
x_xbx1 天前
LeetCode:26. 删除有序数组中的重复项
数据结构·算法·leetcode
j_xxx404_1 天前
力扣困难算法精解:串联所有单词的子串与最小覆盖子串
java·开发语言·c++·算法·leetcode·哈希算法
big_rabbit05021 天前
[算法][力扣167]Two Sum II
算法·leetcode·职场和发展
Eward-an1 天前
LeetCode 76. 最小覆盖子串(详细技术解析)
python·算法·leetcode·职场和发展
不想看见4041 天前
Reverse Bits位运算基础问题--力扣101算法题解笔记
笔记·算法·leetcode