Given the root of a binary tree, return the length of the longest path where every node along the path possesses the same value. The path is not required to pass through the root.
Note: The length of the path between two nodes is defined by the number of edges connecting them.
Constraints:
The number of nodes in the tree is in the range
Node.val
The depth of the tree will not exceed
Given the root of a binary tree, return the length of the longest path where every node along the path possesses the same value. The path is not required to pass through the root.
Note: The length of the path between two nodes is defined by the number of edges connecting them.
Constraints:
The number of nodes in the tree is in the range
Node.val
The depth of the tree will not exceed