class Solution {
public boolean isSubsequence(String s, String t) {
if(s==null||s.length()==0)return true;
if(t==null||t.length()==0)return false;
int len = s.length();
int i = 0;
int j = 0;
while (i < len && j < t.length()) {
if(s.charAt(i)==t.charAt(j))i++;
if (i == s.length()) {
return true;
}
j++;
}
return false;
}
}
京公网安备 11010502036488号