https://oj.leetcode.com/problems/scramble-string/
http://blog.csdn.net/linhuanmars/article/details/24506703
Public class solution { public boolean isscramble (String S1,&NBSP;STRING&NBSP;S2) { if (s1 == null | | s2 == null | | s1.length () != s2.length ()) return false; if (S1.isempty () && s2.isempty ()) return true; int length = s1.length (); boolean r[][][] = new Boolean[length][length][length + 1]; // 1 ->&nBsp;length; for (int i = 0 ; i < length ; i ++) { for (int j = 0 ; j < length ; j ++) { r[i][j][1] = s1.charat (i) == s2.charat (j); } } for (int len = 2 ; len <= length ; len ++) { for (int i = 0 ; i < length - len + 1 ; i ++) { for (int j = 0 ; j < length - len + 1 ; j ++) { for (int k = 1 ; k < len ; k ++) { r[i][j][len] |= (R[i][j][k] &NBSP;&&&NBSP;R[I&NBSP;+&NBSP;K][J&NBSP;+&NBSP;K][LEN&NBSP;-&NBSP;K]) | | (r[i][j + len - k][k] && r[i + k][j][ LEN&NBSP;-&NBSP;K]); } } } } return r[0][0][length]; }}
[Leetcode]87 Scramble String