点击打开链接
class Solution{
public:
bool isSubsequence(string s, string t) {
int sSize = s.size();
int tSize = t.size();
if (!sSize) return true;
int indexS = 1;
int indexT = 1;
while(indexS <(sSize-1) && indexT <(tSize-1)) {
if (s[indexS] == t[indexT]) {
indexS++;
}
indexT++;
}
if (indexS == (sSize -1)) return true;
return false;
}
};