← 返回 meta 的题目列表Diameter of a Tree
类型:online_judge
meta
Given a binary tree, you need to compute the length of the tree's diameter. The diameter of a tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root.
Input: A binary tree.
Output: The diameter of the tree.
Example
Input
1 2 3 4 5