herrDeng網內搜尋

自訂搜尋

Ads

2023年7月31日 星期一

C++動態規劃DP解Leetcode 712,1143 LCS問題



C++動態規劃DP解Leetcode 712,1143 LCS問題。利用計算公式minimumDeleteSum=asciiSum(s1)+asciiSum(s2)−2×asciiSum(LCS)
LCS(Longest common subsequence)之類的問題其實跟 DNA 序列的比對問題密切關聯。就先用一般的遞迴加上記憶的動態規劃來解,要更快的演算法,那就是研究問題
-----------------------------------------
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

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章