@@ -0,0 +1,1105 @@
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0Apublic class Solution %7B%0A    public List%3CInteger%3E findAnagrams(String s, String p)%7B%0A        List%3CInteger%3E res = new ArrayList%3C%3E();%0A        if (s.length() %3C p.length()) return res;%0A        int%5B%5D alphabets = new int%5B26%5D;%0A        int nonZero = 0;%0A        for (char c : p.toCharArray())%7B%0A            alphabets%5Bc-'a'%5D++;%0A        %7D%0A%0A        int left = 0, right = 0, count = p.length();%0A%0A        while (right %3C s.length())%7B%0A            if (alphabets%5Bs.charAt(right++)-'a'%5D-- %3E= 1) count--;%0A            if (count == 0) res.add(left);%0A            if (right - left == p.length() && alphabets%5Bs.charAt(left++)-'a'%5D++ %3E= 0) count++;%0A        %7D%0A        return res;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        String s1= %22cbaebabacd%22, p1 = %22abc%22;%0A        String s2 = %22abab%22, p2 = %22ab%22;%0A        String s3 = %22baa%22, p3 = %22aa%22;%0A        Solution solution = new Solution();%0A        System.out.println(solution.findAnagrams(s1, p1));%0A        System.out.println(solution.findAnagrams(s2, p2));%0A        System.out.println(solution.findAnagrams(s3, p3));%0A    %7D%0A%7D%0A

complete problem 438