f[i][j]表示的是以第i个结尾和第j个结尾 class Solution { public: /* * @param A: A string * @param B: A string * @return: the length of the longest common substring. */ int longestCommonSubstring(string &A, string &B) { // write your code here int length1 = A.leng…
Longest Common Subsequence最长公共子序列: 每个dp位置表示的是第i.j个字母的最长公共子序列 class Solution { public: int findLength(vector<int>& A, vector<int>& B) { int len1 = A.size(); int len2 = B.size(); || len2 == ) ; vector<vector<,vector<)); ;i <=…
Language: Default Long Long Message Time Limit: 4000MS Memory Limit: 131072K Total Submissions: 21228 Accepted: 8708 Case Time Limit: 1000MS Description The little cat is majoring in physics in the capital of Byterland. A piece of sad news comes…