滑动窗口+Hash吧, O(n) 的复杂度,比较时只需要对比两个串hash之后的值。     public static int find(String father, String child){         int len1 = father.length();         int len2 = child.length();         if(len1<len2 || len1<=0){             return -1;         }         // 初始化2的N次方         int[] N2 = new int[26];         for(int i=0; i<26; i++){             N2[i] = (int) Math.pow(2,i);         }         // 计算child的值         int childValue = 0;         for(int i=0; i<len2; i++){             childValue += N2[child.charAt(i)-'a&(417)#39;];         }         // System.out.println("childValue---"+ childValue);         int fatherValue = 0;         for(int i=0; i<len1; i++){             if(i>=len2){                 fatherValue -= N2[father.charAt(i-len2)-'a&(417)#39;];             }             fatherValue += N2[father.charAt(i)-'a&(417)#39;];             if(fatherValue == childValue){                 return i-len2+1;             }         }         return -1;     }