Back to course home
0% completed
Vote For New Content
Slightly Different Go Solution
jonah butler
Jun 4, 2025
func (sol *Solution) isPalindrome(s string) bool { first, last := 0, len(s) - 1 for first < last { r1, r2 := rune(s[first]), rune(s[last]) if !unicode.IsLetter(r1) && !unicode.IsDigit(r1) { first++ continue } if !unicode.IsLetter(r2) && !unicode.IsDigit(r2) { last-- continue } if unicode.ToLower(r1) != unicode.ToLower(r2) { return false } first++ last-- } return true }
Pretty similar to the original solution, but the conditional expressions with continue as opposed to the inner for loops feels a bit easier for me to follow.
0
0
Comments
Comments
On this page