题目:
代码(首刷自解 day3):
class Solution {
public:
bool isSubsequence(string s, string t) {
int s_len=s.size();
int t_len=t.size();
int i=0,j=0;
while(i<s_len&&j<t_len){
if(s[i]==t[j]){i++;j++;}
else j++;
}
if(i<s_len)return false;
else return true;
}
};