AC代码: class Solution { public: int longestCommonSubsequence(string text1, string text2) { int dp[1005][1005] = {0}; int n = text1.size(); int m = text2.size(); for (int i = 1; i <= n; i++){ for (int j = 1; j <= m; j++){ if (text1[i-1] == text2[j-1]) dp[i][j] = 1 + dp[i-1][j-1]; else{ dp[i][j] ...