Practice Discrete Math

Algorithms / Palindrome Manacher Lite

Least You Need to Know: Palindrome Centers, Symmetry, and Manacher-Lite Intuition

Palindrome reasoning starts from centers and symmetry. Manacher's algorithm pushes that idea further by reusing information from the current rightmost palindrome to compute all palindrome radii in linear time.

The least you need to know

Key notation

center middle point around which a palindrome is symmetric
radius how far a palindrome extends from its center
mirror reflected center inside the current known palindrome window

Tiny worked example

  • In `racecar`, the center is `e` and expansion matches characters symmetrically outward.
  • If you already know a long palindrome window, a mirrored center inside that window inherits a lower bound on its radius.
  • Manacher uses that reuse to skip repeated comparisons.
  • The same center idea handles both odd and even palindromes with the right representation.

Common mistakes

How to recognize this kind of problem

Next recommended lesson

Continue through this topic with Least You Need to Know: Partitioning Invariants and Dutch-Flag Regions.

Least You Need to Know: Partitioning Invariants and Dutch-Flag Regions

Related lessons

Keep going with nearby lessons in the same topic.

More ways to explore

Start practice