Return the diameter of a binary tree: the number of edges on the longest path between any two nodes (the path need not pass through the root).
Input: one line — the tree in level order. Output: the diameter.
1 2 3 4 5
3
Path 4 → 2 → 1 → 3 (3 edges).
1 2
1
Run your code against the sample tests, or Submit to run the full suite.