longest common subsequence

See: https://blog.csdn.net/hrn1216/article/details/51534607

Suppose we use c[i,j] to represent the length of the LCS of Xi and Yj (it is not realistic to directly save the intermediate result of the longest common subsequence, you need to use the length of the LCS first). where X={x1...xm}, Y={y1...yn}, Xi={x1...xi}, Yj={y1...yj}. The recursive formula can be obtained as follows:

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325871081&siteId=291194637