@@ -0,0 +1,1922 @@
+import java.util.Arrays;%0A%0Apublic class LeetCode0087 %7B%0A    public boolean isScramble(String s1, String s2) %7B%0A        if (s1 == null %7C%7C s2 == null %7C%7C s1.length() != s2.length()) %7B%0A            return false;%0A        %7D%0A        if (s1.length() == 0 && s2.length() == 0) %7B%0A            return true;%0A        %7D%0A%0A        if (s1.length() == 1 && s2.length() == 1) %7B%0A            if (s1.equals(s2)) %7B%0A                return true;%0A            %7D else %7B%0A                return false;%0A            %7D%0A        %7D%0A        return isScrambleDFS(s1, s2);%0A    %7D%0A%0A    private boolean isScrambleDFS(String s1, String s2) %7B%0A        if (s1.length() == 1) %7B%0A            return true;%0A        %7D%0A        if (!isContainsSame(s1, s2)) %7B%0A            return false;%0A        %7D%0A%0A        for (int i = 1; i %3C s1.length(); i++) %7B%0A            String s1Left = s1.substring(0, i);%0A            String s1Right = s1.substring(i);%0A            String s2Left = s2.substring(0, i);%0A            String s2Right = s2.substring(i);%0A            if (isScrambleDFS(s1Left, s2Left) && isScrambleDFS(s1Right, s2Right)) %7B%0A                return true;%0A            %7D%0A%0A            s2Left = s2.substring(0, s2.length() - i);%0A            s2Right = s2.substring(s2.length() - i);%0A            if (isScrambleDFS(s1Left, s2Right) && isScrambleDFS(s1Right, s2Left)) %7B%0A                return true;%0A            %7D%0A        %7D%0A        return false;%0A    %7D%0A%0A    private boolean isContainsSame(String s1, String s2) %7B%0A        char%5B%5D array1 = s1.toCharArray();%0A        char%5B%5D array2 = s2.toCharArray();%0A        Arrays.sort(array1);%0A        Arrays.sort(array2);%0A        for (int i = 0; i %3C array1.length; i++) %7B%0A            if (array1%5Bi%5D != array2%5Bi%5D) %7B%0A                return false;%0A            %7D%0A        %7D%0A        return true;%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        LeetCode0087 leetcode = new LeetCode0087();%0A        System.out.println(leetcode.isScramble(%22great%22, %22rgtae%22));%0A    %7D%0A%7D%0A

Add LeetCode0087.java