Given the root of a binary tree, return the length (number of edges) of the longest path where every node on the path has the same value. The path need not pass through the root. The tree is given as a level-order array with null for missing children.
Input: A level-order array of the tree.
Output: Integer — the longest univalue path length in edges.
Input: [5,4,5,1,1,null,5]
Output: 2
Explanation: Path of 5's spans 2 edges.Input: [1,4,5,4,4,null,5]
Output: 2
Explanation: Path of 4's spans 2 edges.Input: [1]
Output: 0
Explanation: Single node, no edges.0<=nodes<=10^4-1000<=value<=1000