(root, maxValue = [-Infinity])
| 5 | * @return {number} |
| 6 | */ |
| 7 | var maxPathSum = function (root, maxValue = [-Infinity]) { |
| 8 | pathSum(root, maxValue); |
| 9 | |
| 10 | return maxValue[0]; |
| 11 | }; |
| 12 | |
| 13 | const pathSum = (root, maxValue) => { |
| 14 | const isBaseCase = root === null; |