答案写的最简便以理解的
https://blog.csdn.net/Bob__yuan/article/details/99690889
除了返回个数,要返回字符串的方法
int i = len1, j = len2;
vector<vector<int>> dp = lcs;
while (i != 0 && j != 0) {
if (dp[i][j] == dp[i - 1][j]) i--;
else if (dp[i][j] == dp[i][j - 1]) j--;
else {
str.push_back(text1[i - 1]);
i--;
j--;
}
}
dp分析的
https://www.cnblogs.com/wkfvawl/p/9362287.html
https://blog.csdn.net/trochiluses/article/details/37966729