最长公共子序列

public static void printStr(int [][]b, String A, int i, int j) {
if (i == 0 || j == 0)return;
if (b[i][j] == 1) {
System.out.print("-" + A.charAt(i - 1));
printStr(b, A, i - 1, j - 1);
} else if (b[i][j] == 0) {
printStr(b, A, i, j - 1);
} else if (b[i][j] == -1) {
printStr(b, A, i - 1, j);
}
}

public static ArrayList set = new ArrayList();

public static void print(char []arr, int start, int end){
if (start == end) {
set.add(new String(arr));
}
for (int i = start; i < end; i++) {
char c = arr[start];
arr[start] = arr[i];
arr[i] = c;
print(arr, start + 1, end);
arr[i] = arr[start];
arr[start] = c;
}
}

你可能感兴趣的:(最长公共子序列)