392.判断子序列
作者:互联网
class Solution { public: bool isSubsequence(string s, string t) { if(s.size() >t.size()){ return false; } if(s.size()==0){ return true; } int l=0,r=0; while(l<s.size() && r<t.size()){ while(r<t.size() && s[l]!=t[r]){ r++; } if(l<s.size() && r<t.size() && s[l]==t[r]){ l++; r++; } } return l==s.size(); } };
标签:判断,return,string,int,isSubsequence,Solution,392,序列,size 来源: https://www.cnblogs.com/wustjq/p/15705243.html