Data Structures & AlgorithmsHardICPC regional · strings

Problem: Which claim about the Manacher algorithm is correct?

  1. A. It needs O(n^2) time because it compares all pairs
  2. B. It only works on binary strings
  3. C. It finds all palindromic substring radii in O(n) time
  4. D. It returns the number of inversions

Correct answer: C. It finds all palindromic substring radii in O(n) time

The mirror property of palindromes lets Manacher reuse radii, giving linear time overall.

More Coding Interview Problems questions

Exams that ask this topic