/**
public class TreeNode {
    int val = 0;
    TreeNode left = null;
    TreeNode right = null;

    public TreeNode(int val) {
        this.val = val;

    }

}
*/
public class Solution {
    LinkedList<Integer> path = new LinkedList<>();
    ArrayList<ArrayList<Integer>> result = new ArrayList<>();
    public ArrayList<ArrayList<Integer>> FindPath(TreeNode root,int expectNumber) {
        //递归应该能解决吧
         dfs(root,expectNumber);
        return result;
    }
    void dfs(TreeNode root, int target){
        if(root == null){
            return;
        }
        path.add(root.val);
        target -= root.val;
        
        if(target == 0 && root.left == null && root.right == null){
            result.add(new ArrayList<>(path));
        }
        //如果仅仅是为 0 还是需要回溯 或者找其他左 右数递归
        dfs(root.left, target);
        dfs(root.right, target);
        path.removeLast();
    }
}