Given a binary tree in which each node holds an integer value, determine the maximum path sum that connects two leaf nodes. A leaf node is defined as a node that does not have any left or right children. The path, which must begin and end at leaf nodes, can pass through intermediate (parent) nodes. The path sum is calculated as the sum of the node values along the traversal.
Constraints:
- The number of nodes in tree is in the range
. - A tree must be a binary tree.
Ask AI Assistant

Ask AI Assistant
Ask me anything about this coding question!
Test Cases
Input
Output
Expected