524.通过删除字母匹配到字典里最长单词

class Solution {
    public String findLongestWord(String s, List d) {
        String longest="";
        for (String target:
             d) {
            int l1=longest.length();
            int l2=target.length();
            if(l1>l2||(l1==l2&&longest.compareTo(target)<0))
            {continue;}
            if (isSubStr(s,target)){
                longest=target;
            }
        }
        return longest;
    }
    public boolean isSubStr(String s,String target){
        int l1=s.length(),l2=target.length();
        int i=0,j=0;
        while (i

你可能感兴趣的:(524.通过删除字母匹配到字典里最长单词)