目录

力扣543. 二叉树的直径

力扣543. Diameter of Binary Tree(二叉树的直径)

计算二叉树的直径长度。

示例 1:

../posts/01_学习/87_LeetCode/0543_二叉树的直径/img/543-1-description.png

输入:root = [1,2,3,4,5]
输出:3
解释:路径 [4,2,1,3] 或 [5,2,1,3] 长度为 3。

提示:

  • 详见原题。