Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS

What is the minimum number of characters that must be deleted from "abcbdab" to make it a palindrome?

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

Correct answer: D. 2

Deletions needed equal n minus the longest palindromic subsequence, found by interval DP. Reporting the palindrome length itself answers a different question.

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

Exams that ask this topic