String Manacher the longest palindrome string.

Source: Internet
Author: User

The longest palindrome substring is a substring of a string that reads from left to right and from right to left.

The Manacher algorithm can be used to ask, his complexity is O (n).

Can read this article http://blog.csdn.net/ywhorizen/article/details/6629268

But there should be a mistake (tangled up my day ...) )

This is the sentence, the article is said when Mx-i <= Mp[j] time to use, because the back is not compared.

  

However, the blue part is equal, if the red is equal to blue, then Mx can not be this value, so the red must not be equal to the blue, so that only when mx-i = = Mp[j] or mx<=i is to be used.

String Manacher the longest palindrome string.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.