Skip to content
Embercode
✕
StringsQuick quiz

Palindromes, Lyndon and string DP

8 questions. Covers String DP: edit distance and LCS variants.

Questions 1 to 5 of 8

  1. 1. Manacher's loop for an odd center i inside the window [l, r] starts the radius at min(d1[l + r - i], r - i + 1), not at d1[l + r - i] alone. Why is the cap r - i + 1 needed?
  2. 2. An AI counts the palindromic substrings of aaaa as sum(d1) + sum(d2). Which number should it print?

    Type a number.

  3. 3. For the string abba, the program prints d1 = [1, 1, 1, 1] and d2 = [0, 0, 2, 0]. Which statements about the even-center array are true?

    Pick every answer that is true.

  4. 4. An AI wrote the factor step of Duval's factorisation as res.push_back(s.substr(i, j - i)); and says the result is correct. On the input abcdba it prints abcdba and then a. What is wrong?
  5. 5. A checker for the smallest rotation of abab compares the returned index with 0 only. An AI returns index 2 and the checker marks it wrong. What is the right judgement?

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.