@@ -0,0 +1,1037 @@
+package problems;%0A%0Apublic class InterleavingString %7B%0A    public boolean isInterleave(String s1, String s2, String s3) %7B%0A        if (s1 == null %7C%7C s2 == null %7C%7C s3 == null)%0A            return false;%0A%0A        int n1 = s1.length(), n2 = s2.length();%0A        if (s3.length() != n1 + n2)%0A            return false;%0A%0A        boolean%5B%5D%5B%5D b = new boolean%5Bn1 + 1%5D%5Bn2 + 1%5D;%0A        b%5B0%5D%5B0%5D = true;%0A        for (int i = 0; i %3C= n1; i++) %7B%0A            for (int j = 0; j %3C= n2; j++) %7B%0A                if (i %3E 0 && b%5Bi - 1%5D%5Bj%5D && s1.charAt(i - 1) == s3.charAt(i + j - 1))%0A                    b%5Bi%5D%5Bj%5D = true;%0A                else if (j %3E 0 && b%5Bi%5D%5Bj - 1%5D && s2.charAt(j - 1) == s3.charAt(i + j - 1))%0A                    b%5Bi%5D%5Bj%5D = true;%0A            %7D%0A        %7D%0A        return b%5Bn1%5D%5Bn2%5D;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        InterleavingString is = new InterleavingString();%0A        String s1 = %22aabcc%22;%0A        String s2 = %22dbbca%22;%0A        String s3 = %22aadbbcbcac%22;%0A        System.out.println(is.isInterleave(s1, s2, s3));%0A    %7D%0A%7D%0A

Add Interleaving String