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

Function max_path_sum

python3/Trees/maximum_path_sum.py:15–18  ·  view source on GitHub ↗
(root: TreeNode)

Source from the content-addressed store, hash-verified

13max_sum = float('-inf')
14
15def max_path_sum(root: TreeNode) -> int:
16 global max_sum
17 max_path_sum_helper(root)
18 return max_sum
19
20def max_path_sum_helper(node: TreeNode) -> int:
21 global max_sum

Callers

nothing calls this directly

Calls 1

max_path_sum_helperFunction · 0.85

Tested by

no test coverage detected