状态转移方程:
if(st1[i]==st2[j])
res[i+1][j+1]=res[i][j]+1;
else
res[i+1][j+1]= res[i][j+1]>res[i+1][j] ?res[i][j+1]:res[i+1][j] ;
res[i][j]表示字符串字串st1[0-i],st2[0-j]的公共子序列长度。
状态转移方程:
if(st1[i]==st2[j])
res[i+1][j+1]=res[i][j]+1;
else
res[i+1][j+1]= res[i][j+1]>res[i+1][j] ?res[i][j+1]:res[i+1][j] ;
res[i][j]表示字符串字串st1[0-i],st2[0-j]的公共子序列长度。