You are given the root of a binary tree. Your task is to find the maximum path sum.
A path is a sequence of connected nodes where:
Return the maximum possible sum of values along any valid path.
Input: root = [1,2,3]
Output: 6
Explanation: The maximum path is 2 → 1 → 3 with a sum of 6.
Input: root = [-10,9,20,null,null,15,7]
Output: 42
Explanation: The maximum path is 15 → 20 → 7 with a sum of 42.
Input: root = [-3]
Output: -3
Explanation: The only valid path consists of the single node.
Sign in to write, run, and submit your solution against the full test suite.