restructure solutions dir

This commit is contained in:
kanna5 2025-12-23 17:32:45 +09:00
parent f9ddad5f88
commit ccb8b5673b
10 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,32 @@
package q125
func isAlphanumeric(c byte) bool {
return c >= '0' && c <= '9' ||
c >= 'a' && c <= 'z'
}
func toLower(c byte) byte {
if c >= 'A' && c <= 'Z' {
return 'a' + c - 'A'
}
return c
}
func isPalindrome(s string) bool {
conv := make([]byte, 0, len(s))
for i := range len(s) {
c := toLower(s[i])
if isAlphanumeric(c) {
conv = append(conv, c)
}
}
for i := range len(conv) / 2 {
if conv[i] != conv[len(conv)-1-i] {
return false
}
}
return true
}
var _ = isPalindrome