392.判断子序列
会,但不知道咋的,感觉用Java做题就是不太顺手,这题我好像还做麻烦了。
class Solution {
public boolean isSubsequence(String s, String t) {
if(s.length()==0)
return true;
boolean[] flag=new boolean[s.length()];
int j=0;
for(int i=0;iwhile(j if(s.charAt(i)==t.charAt(j)){
flag[i]=true;
j++;
break;}
j++;}
return flag[s.length()-1];}
}
521.最长特殊序列Ι
脑筋急转弯,我不会
class Solution {
public int findLUSlength(String a, String b) {
return !a.equals(b)?Math.max(a.length(),b.length()):-1;
}
}