Manacher’s Algorithm: Longest Palindromic Substring

4 min readSep 27, 2021

This article will break down Manacher’s algorithm clearly, so that the reader can build a solid mental model. But first, we need to briefly break down the problem at hand — finding the longest palindromic substring.

Longest Palindromic Substring

If just reading the above sub-heading has you nodding your head, you can probably skip forward to the next section. If not, take a look at the below example:

let str = "abbccbbaxxyyxx"

Software engineer writing about programming, learning, & more. Highly caffeinated. In a committed relationship with the Oxford comma.