**Problem Statement:**
Given the required input arguments, write an efficient algorithm to solve the **Binary Tree Max Path Sum** problem. Implement the required logic as specified by standard definitions for this classic algorithmic challenge.
**Hint / Expected Approach:**
DFS returning single-branch gain; update global max
**Edge Cases to Consider:**
- (1) All negative values
- (2) Single node
- (3) Path through root is suboptimal
Examples
Example 1
Input:[1,2,3]
Output:6
Explanation: 2+1+3=6 through root
Example 2
Input:[-10,9,20,null,null,15,7]
Output:42
Explanation: 15+20+7=42
Example 3
Input:[-3]
Output:-3
Explanation: Single negative node
Constraints
▪The number of nodes in the tree is in the range [0, 2000]
▪-1000 <= Node.val <= 1000
▪Ensure depth-first or breadth-first traversals are memory-efficient