Data Structures & AlgorithmsHardTCS NQT · Product Company SDE

Problem: The string "racecarxyz" is examined for palindromic substrings of length at least 5. How many such palindromic substrings are there?

  1. A. 3
  2. B. 1
  3. C. 2
  4. D. 4

Correct answer: C. 2

Check all index ranges of length at least five. 'racecar' and its inner palindrome 'aceca' qualify, while 'cec' is too short to count.

More Coding Interview Problems questions

Exams that ask this topic