Data Structures & AlgorithmsHardProduct Company SDE · Amazon OA

Problem: The longest palindromic subsequence of "character" has what length?

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

Correct answer: A. 5

Interval DP over substrings: matching ends add two to the inner value, otherwise drop one end. Using the longest palindromic substring instead gives a smaller number.

More Coding Interview Problems questions

Exams that ask this topic