mirror of
https://gitlab.com/game-loader/hugo.git
synced 2025-04-20 14:02:07 +08:00
change leetcode contetn
This commit is contained in:
parent
5a44b40b64
commit
741f4f63b1
@ -17,6 +17,8 @@ The diameter of a binary tree is the length of the longest path between any two
|
|||||||
|
|
||||||
The length of a path between two nodes is represented by the number of edges between them.
|
The length of a path between two nodes is represented by the number of edges between them.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### 题解
|
### 题解
|
||||||
|
|
||||||
读题, 题目要求寻找二叉树中任意两节点之间的最大距离. 这时这个二叉树更像是一个图的性质而不是树, 即寻找图中任意两节点直接的最大距离. 考虑任意一点到另一点的距离等于其到另一点的父节点的距离减一, 则使用一个二维数组保存每个节点的两个属性:
|
读题, 题目要求寻找二叉树中任意两节点之间的最大距离. 这时这个二叉树更像是一个图的性质而不是树, 即寻找图中任意两节点直接的最大距离. 考虑任意一点到另一点的距离等于其到另一点的父节点的距离减一, 则使用一个二维数组保存每个节点的两个属性:
|
||||||
|
Loading…
Reference in New Issue
Block a user