Special String Again

  • + 0 comments

    I feel this is a very complicated answer. You can solve this problem in 10 lines, using the same logic as you would manually do when you solve it by hand : For each index i in the string, I create a cursor k that starts from i and goes forward until it meets a different letter than s[i] at s[i+k]. Then I check if the string starting from s[i] centrered on s[i+k] could be a palindrome.

    I put my code in this discussion