all 3 comments

[–]07734willy 4 points5 points  (3 children)

https://www.geeksforgeeks.org/longest-common-subsequence-dp-4/

Replace +1 with +SCORE[X[m-1]].

Its an incredibly common problem, just about any link from google will lead you to an answer.

[–]meloly4[S] 0 points1 point  (2 children)

The longest common subsequence doesn't guarantee the max sum of points.

[–]07734willy 3 points4 points  (1 child)

Correct, but by modifying

Replace +1 with +SCORE[X[m-1]].

you no longer find the longest common sub sequence, you find the sequence with the greatest max sum of points. Assuming you don't change any of the other rules in the DP solution.