public static void dfsBtree(TreeNode root, int target, ArrayList<Integer> tmp,
            ArrayList<ArrayList<Integer>> list) {
        if (root.left == null && root.right == null) {
            int sum = 0;
            for (int i = 0; i < tmp.size(); i++) {
                sum += tmp.get(i);
            }
            if (sum == target) {
                list.add(new ArrayList<Integer>(tmp));
            }
        } else {
            if (root.left != null) {
                tmp.add(root.left.val);
                dfsBtree(root.left, target, tmp, list);
                tmp.remove(tmp.size() - 1);
            }

            if (root.right != null) {
                tmp.add(root.right.val);
                dfsBtree(root.right, target, tmp, list);
                tmp.remove(tmp.size() - 1);
            }
        }
    }