Tagged articles
1 articles
Page 1 of 1
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 algorithmPythonString processing
0 likes · 12 min read
Mastering Manacher’s Algorithm: Find the Longest Palindromic Substring in O(N)