算法标签 双指针

题目简叙

[LeetCode]392. 判断子序列_双指针

代码

class Solution {
public:
bool isSubsequence(string s, string t) {
int l=0,r=0;
while(l<s.size()&&r<t.size){
if(s[l]==t[r])l++;
r++;
}
return l==s.size();
}
};

AC记录

[LeetCode]392. 判断子序列_双指针_02