add new solutions

This commit is contained in:
Yiyang Kang 2025-12-28 17:07:06 +09:00 committed by kanna5
parent e1b702657c
commit 59b71480d4
Signed by: kkyy
GPG key ID: 06332F3965E9B0CF
11 changed files with 343 additions and 0 deletions

View file

@ -0,0 +1,26 @@
package q205
func isIsomorphic(s string, t string) bool {
if len(s) != len(t) {
return false
}
ab := make(map[byte]byte, 256)
ba := make(map[byte]byte, 256)
for i := range len(s) {
if b, ok := ab[s[i]]; ok {
if t[i] != b {
return false
}
} else {
if _, ok := ba[t[i]]; ok {
return false
}
ab[s[i]] = t[i]
ba[t[i]] = s[i]
}
}
return true
}
var _ = isIsomorphic