MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / maxPathSum

Function maxPathSum

javascript/0124-binary-tree-maximum-path-sum.js:7–11  ·  view source on GitHub ↗
(root, maxValue = [-Infinity])

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

pathSumFunction · 0.85

Tested by

no test coverage detected