Maximum Path Sum from Any Node to Any Node
Hard

Problem Statement

Find the maximum path sum in a binary tree where the path can start and end at any node.

Examples

1Example 1
Input:
{ "root": [ 1, 2, 3 ] }
Output:
6
2Example 2
Input:
{ "root": [ -10, 9, 20, null, null, 15, 7 ] }
Output:
42
3Example 3
Input:
{ "root": [ 2, -1 ] }
Output:
2
Loading...

Sign in to Run Code and Submit