Skip to content

Tag: palindrome

Longest palindrome in a string

I wrote the following function to find the longest palindrome in a string. It works fine but it won’t work for words like “noon” or “redder”. I fiddled around and changed the first line in the for loop from: to and now it works, but I’m not clear on why. My intuition is tha…