Data Structures & AlgorithmsModerateTCS NQT · Accenture

Problem: The string "tenet" is considered. How many of its substrings (by index range, length at least 2) are palindromes?

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

Correct answer: B. 2

Count palindromes of length at least two by index range. The whole string 'tenet' and the inner 'ene' are palindromes, and 'te', 'en', 'ne', 'et' are not.

More Coding Interview Problems questions

Exams that ask this topic