392. 判断子序列
class Solution {
public:
bool isSubsequence(string s, string t) {
int i=0,j=0;
while(i<s.size() && j<t.size()){
if(s[i]==t[j])i++,j++;
else j++;
}
return i==s.size();
}
};
class Solution {
public:
bool isSubsequence(string s, string t) {
int i=0,j=0;
while(i<s.size() && j<t.size()){
if(s[i]==t[j])i++,j++;
else j++;
}
return i==s.size();
}
};
本文标题:392. 判断子序列
本文链接:https://www.haomeiwen.com/subject/yibikktx.html
网友评论