Diameter of a Binary Tree

Question

The diameter of a tree (sometimes called the width) is the number of nodes
on the longest path between two leaves in the tree.
The diagram below shows two trees each with diameter nine,
the leaves that form the ends of a longest path are shaded
(note that there is more than one path in each tree of length nine,
but no path longer than nine nodes).

Diameter of a Binary Tree

题解

和题 Lowest Common Ancestor 分析思路特别接近。

results matching ""

    No results matching ""