Data Structures & AlgorithmsHardProduct Company SDE · ICPC regional

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

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

Correct answer: A. 5

Insertions needed equal length minus the longest palindromic subsequence, the same quantity as minimum deletions. Counting the length of the longest palindromic substring instead is wrong.

More Coding Interview Problems questions

Exams that ask this topic