Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional

What is the minimum number of characters that must be inserted anywhere in "abcb" to make it a palindrome?

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

Correct answer: A. 1

Insertions needed equal n minus the longest palindromic subsequence (here 'bcb' has length 3). Interval DP computes the same count.

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

Exams that ask this topic