https://leetcode.cn/problems/is-subsequence/description/
class Solution {
public boolean isSubsequence(String s, String t) {
// 依据题意,可以判断是求最长公共子序列的特殊情况
// f[i][j]=max(f[i-1][j],f[i][j-1],f[i-1][j-1]+1)
// f[1][1]=1;
int[][] f=new int[110][10010];
char[] s1=s.toCharArray();
char[] s2=t.toCharArray();
for(int i=1;i<=s1.length;i++)
{
for(int j=1;j<=s2.length;j++)
{
f[i][j]=Math.max(f[i-1][j],f[i][j-1]);
if(s1[i-1]==s2[j-1])f[i][j]=Math.max(f[i][j],f[i-1][j-1]+1);
}
}
return f[s1.length][s2.length] == s.length();
}
}
标签:String,int,char,392,序列,leetcode From: https://www.cnblogs.com/lxl-233/p/18402821