* @lc app=leetcode id=113 lang=javascript
* Definition for a binary tree node.
* function TreeNode(val) {
* this.left = this.right = null;
function backtrack(root, sum, res, tempList) {
if (root === null) return;
if (root.left === null && root.right === null && sum === root.val)
return res.push([...tempList, root.val]);
backtrack(root.left, sum - root.val, res, tempList);
backtrack(root.right, sum - root.val, res, tempList);
var pathSum = function (root, sum) {
if (root === null) return [];
backtrack(root, sum, res, []);