Given a binary tree, find the maximum path sum. A path is a sequence of nodes connected by edges, and it doesn't have to pass through the root.
With this tree:
1
/ \
2 3
The max path is 2 → 1 → 3 with sum 6.
With this tree:
-10
/ \
9 20
/ \
15 7
The max path is 15 → 20 → 7 with sum 42. The negative root is excluded.
Nodes can have negative values. A path can start and end at any node.
Constraints: nodes . Values from to .