public void recur(TreeNode root, List<List<Integer>> res, List<Integer> temp, int target, int num) {
        if (root == null)
            return;
        int val = root.val;
        temp.add(val);
        if (root.left == null && root.right == null && num + val == target) {
            res.add(new LinkedList<Integer>(temp));
            temp.remove(temp.size() - 1);
            return;
        }
        recur(root.left, res, temp, target, num + val);
        recur(root.right, res, temp, target, num + val);
        temp.remove(temp.size() - 1);
    }