MCPcopy Create free account
hub / github.com/ByteByteGoHq/coding-interview-patterns / maxPathSum

Function maxPathSum

cpp/Trees/maximum_path_sum.cpp:17–21  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 */
16
17int maxPathSum(TreeNode* root) {
18 int maxSum = std::numeric_limits<int>::min();
19 maxPathSumHelper(root, maxSum);
20 return maxSum;
21}
22
23int maxPathSumHelper(TreeNode* node, int& maxSum) {
24 // Base case: null nodes have no path sum.

Callers

nothing calls this directly

Calls 1

maxPathSumHelperFunction · 0.70

Tested by

no test coverage detected