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