Concept Flow - DP on Trees Maximum Path Sum
Start at root node
Compute max path sum from left subtree
Compute max path sum from right subtree
Calculate max path through current node
Update global max if current path is higher
Return max path sum including current node to parent
Repeat for all nodes
Final max path sum is global max
We start from the root and recursively compute max path sums from left and right children. At each node, we update the global max path sum considering paths through that node. We return the max path sum including the node to its parent.
