class Solution {
public:
bool isSubsequence(string s, string t) {
int n=s.length(),m=t.length();
int i=0,j=0;
while(i<n && j<m){
if(s[i]==t[j]){
i++;
}
j++;
}
return i==n;
}
};
判断s是否是t的子序列
最新推荐文章于 2024-07-08 22:12:26 发布