Data Structures & AlgorithmsHardProduct-company placement

What is the length of the longest common subsequence of PLATFORM and PLACEMENT, and how many DISTINCT longest common subsequences (as strings) are there?

  1. A. Length 4, 1 distinct
  2. B. Length 4, 2 distinct
  3. C. Length 5, 2 distinct
  4. D. Length 4, 3 distinct

Correct answer: B. Length 4, 2 distinct

The LCS table gives length 4; following every tie in the table and keeping distinct strings yields PLAM, PLAT.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic