C++動態規劃DP解Leetcode 712,1143 LCS問題。利用計算公式minimumDeleteSum=asciiSum(s1)+asciiSum(s2)−2×asciiSum(LCS)
-----------------------------------------
The usual process for LCS to compute the ascii sum for LCS. Use the following formula
minimumDeleteSum=asciiSum(s1)+asciiSum(s2)−2×asciiSum(LCS)
Problems like LCS (Longest common subsequence) are actually closely related to the problem of comparing DNA sequences. First use general recursion plus memory dynamic programming to solve it. If you want a faster algorithm, that is the research problem.
----------------------------------------------------
Leetcode 712. Minimum ASCII Delete Sum for Two Strings
Leetcode 1143. Longest Common Subsequence
沒有留言:
張貼留言