You are given the root of a binary tree, where each node contains an integer value.
A valid path in the tree is a sequence of connected nodes such that:
Return an integer denoting the maximum possible sum of node values among all valid paths.
Example 1:

Input: root = [2,2,1]
Output: 3
Explanation:
2 → 2 is invalid because the value 2 is not distinct.2 → 1, with a sum = 2 + 1 = 3.Example 2:

Input: root = [1,-2,5,null,null,3,5]
Output: 9
Explanation:
3 → 5 → 5 is invalid due to duplicate value 5.1 → 5 → 3, with a sum = 1 + 5 + 3 = 9.Example 3:
Input: root = [4,6,6,null,null,null,9]
Output: 19
Explanation:
6 → 4 → 6 → 9 is invalid because the value 6 appears more than once.4 → 6 → 9, with a sum = 4 + 6 + 9 = 19.Constraints:
[1, 1000].-1000 <= Node.val <= 1000Loading editor...
No test cases available.