本文共 578 字,大约阅读时间需要 1 分钟。
bool isSubsequence(char * s, char * t){ int tpos = 0,spos = 0,lengtht = strlen(t),lengths = strlen(s); while(s[spos] && t[tpos] && lengtht >= lengths) { if(s[spos] == t[tpos]) { spos++; lengths--; } tpos++; lengtht--; } if(s[spos]) return false; else return true;}
class Solution { public: bool isSubsequence(string s, string t) { if(!s.size()) return true; int pos = 0,flag = 0; for(int i=0;i
转载地址:http://kzqvf.baihongyu.com/