From 741f4f63b1c2bfb241a2f42745502a33ba2c5eb0 Mon Sep 17 00:00:00 2001 From: gameloader Date: Tue, 27 Feb 2024 11:21:38 +0800 Subject: [PATCH] change leetcode contetn --- content/posts/leetcode.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content/posts/leetcode.md b/content/posts/leetcode.md index b0f1fd2..38cdd2f 100644 --- a/content/posts/leetcode.md +++ b/content/posts/leetcode.md @@ -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. +![0227W27EaKxHpjd2](https://testingcf.jsdelivr.net/gh/game-loader/picbase@master/uPic/0227W27EaKxHpjd2.png) + ### 题解 读题, 题目要求寻找二叉树中任意两节点之间的最大距离. 这时这个二叉树更像是一个图的性质而不是树, 即寻找图中任意两节点直接的最大距离. 考虑任意一点到另一点的距离等于其到另一点的父节点的距离减一, 则使用一个二维数组保存每个节点的两个属性: