Given the root of a binary tree, return the maximum sum of any non-empty path.
A path in a binary tree is defined as follows:
You can calculate the path sum by adding up all node values in the path. To solve this problem, calculate the maximum path sum given the root of a binary tree so that there won’t be any greater path than it in the tree.
Constraints:
Given the root of a binary tree, return the maximum sum of any non-empty path.
A path in a binary tree is defined as follows:
You can calculate the path sum by adding up all node values in the path. To solve this problem, calculate the maximum path sum given the root of a binary tree so that there won’t be any greater path than it in the tree.
Constraints: