🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: String Matching — KMP and Rabin-Karp: all 10 questions

Quiz: String Matching — KMP and Rabin-Karp · Question 10 of 10

A string has length 9 and lps[8] = 6. What does that tell you?

A string has length 9 and lps[8] = 6. What does that tell you?

  1. A.It has no repeated block
  2. B.Its first 6 letters are all the same
  3. C.It is a palindrome
  4. D.It is made of a block of length 9 − 6 = 3 repeated, because 3 divides 9
Answer & explanation

Correct answer: It is made of a block of length 9 − 6 = 3 repeated, because 3 divides 9

For example "abcabcabc": the period p = n − lps[n − 1] = 3 divides 9.

Can you get the rest right without peeking?

Take the timed Quiz: String Matching — KMP and Rabin-Karp quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →