动态规划经典例题——最长公共子序列和最长公共子串(python)

1. 最长公共子序列(LCS) 1.1 问题描述 1.2 思路 利用动态规划。 下一步就要找到状态之间的转换方程。 所以能够根据这个方程来进行填表,以"helloworld"和“loop”为例: python 1.3 Python代码 def LCS(string1,string2): len1 = len(string1) len2 = len(string2) res
相关文章
相关标签/搜索