Data Structures & AlgorithmsVery hardCodeforces Div2 D · ICPC regional

How many DISTINCT palindromic substrings (by content, length at least 1) does "abaaba" have?

  1. A. 8
  2. B. 11
  3. C. 7
  4. D. 6

Correct answer: D. 6

Count palindromes by content with a set, or use an eertree. Counting palindromic positions (repeats included) gives a larger number, and the palindrome count of a single letter is also easy to forget.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic