Tree diameter edges
Your task
Given a binary tree as a level-order array (null for missing), return the length of its diameter measured in EDGES, the number of edges on the longest path between any two nodes, which need not pass through the root. An empty tree has diameter 0 and a single node has diameter 0.
Examples
tree_diameter(level: list) -> intExample 1
Input
tree_diameter([1, 2, 3, 4, 5])Output
3