paint-brush
Manacher’s Algorithm Explained— Longest Palindromic Substringby@mithratalluri
13,762 reads
13,762 reads

Manacher’s Algorithm Explained— Longest Palindromic Substring

by Mithra Talluri6mNovember 7th, 2020
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

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:

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - Manacher’s Algorithm Explained— Longest Palindromic Substring
Mithra Talluri HackerNoon profile picture
Mithra Talluri

Mithra Talluri

@mithratalluri

Solving smaller problems today to solve bigger problems tomorrow!

Learn More
LEARN MORE ABOUT @MITHRATALLURI'S
EXPERTISE AND PLACE ON THE INTERNET.
L O A D I N G
. . . comments & more!

About Author

Mithra Talluri HackerNoon profile picture
Mithra Talluri@mithratalluri
Solving smaller problems today to solve bigger problems tomorrow!

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite