NC67 汉诺塔问题
import java.util.*;
public class Solution {
ArrayList<String> res = new ArrayList<>();
public ArrayList<String> getSolution(int n) {
// write code here
help(n, "left", "mid", "right");
return res;
}
private void help(int n , String left, String mid, String right){
if (n == 0){
return;
}
help(n - 1, left, right, mid);
res.add("move from " + left + " to " + right);
help(n - 1, mid, left, right);
}
}