Tag

Manacher algorithm

1 views collected around this technical thread.

Code Mala Tang
Code Mala Tang
Apr 12, 2025 · Fundamentals

Mastering Manacher’s Algorithm: Find the Longest Palindromic Substring in O(N)

Manacher’s algorithm transforms the classic longest palindromic substring problem into a linear‑time solution by preprocessing the string with separators, tracking palindrome radii, and efficiently updating the center and right boundary using mirror positions, with detailed Python code and step‑by‑step illustrations.

Manacher algorithmPythonalgorithm tutorial
0 likes · 12 min read
Mastering Manacher’s Algorithm: Find the Longest Palindromic Substring in O(N)