Too Long; Didn't Read
Manacher’s Algorithm helps us find the longest palindromic substring in the given string. It optimizes over the brute force solution by using some insights into how Palindromes work. When we move i from left to right, we try to “expand” the palindrome at each i. This is exactly where Manacher's algorithm optimizes better than brute force. The answer for a given string is 9 when the Palindrome is centered at index 5; c, l, and r are as follows: