Data Structures & AlgorithmsHardICPC regional · string round

Problem: Which property does the KMP failure function of a string satisfy?

  1. A. It counts all palindromes
  2. B. It is always increasing
  3. C. It is the length of the longest proper prefix that is also a suffix for each prefix
  4. D. It stores the position of the last occurrence

Correct answer: C. It is the length of the longest proper prefix that is also a suffix for each prefix

pi[i] is the longest proper border of the prefix ending at i, which KMP uses to avoid rechecking characters.

More Coding Interview Problems questions

Exams that ask this topic