Skip to content
Advertisement

Tag: palindrome

I need to write difficult palindrome

That’s my example. String are given. Implement a function – detectPalindrom, that can detect palindrome string. Given argument not an string – return ‘Passed argument is not a string’. Given string is empty – return ‘String is empty’. Given string palindrome – return ‘This string is palindrome!’. Given string is not a palindrome – return ‘This string is not a

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 that if you are checking an odd-length

Advertisement