This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string getLongestCommonSubString(string a, string b) | |
{ | |
/* | |
dp[i, j] 为a[0, i - 1] 与 b[0, j - 1]末尾连续相等元素的数量 | |
dp[i, j] = 0 (a[i] != b[j]) | |
dp[i, j] = dp[i - 1, j - 1] + 1 (a[i] == b[j]) | |
*/ | |
vector<vector<int>> dp(a.length() + 1, vector<int>(b.length() + 1, 0)); | |
int index = 0; |
OlderNewer