Skip to content

Commit 8b41ad3

Browse files
committed
Added English README
1 parent 8c1235b commit 8b41ad3

File tree

1 file changed

+31
-0
lines changed
  • leetcode/0543.Diameter-of-Binary-Tree

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# [543. Diameter of Binary Tree](https://leetcode.com/problems/diameter-of-binary-tree/)
2+
3+
## 题目
4+
5+
Given the `root` of a binary tree, return the length of the **diameter** of the tree.
6+
7+
The **diameter** of a binary 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`.
8+
9+
The **length** of a path between two nodes is represented by the number of edges between them.
10+
11+
**Example 1:**
12+
13+
![https://assets.leetcode.com/uploads/2021/03/06/diamtree.jpg](https://assets.leetcode.com/uploads/2021/03/06/diamtree.jpg)
14+
15+
```
16+
Input: root = [1,2,3,4,5]
17+
Output: 3
18+
Explanation: 3 is the length of the path [4,2,1,3] or [5,2,1,3].
19+
```
20+
21+
**Example 2:**
22+
23+
```
24+
Input: root = [1,2]
25+
Output: 1
26+
```
27+
28+
**Constraints:**
29+
30+
- The number of nodes in the tree is in the range `[1, 104]`.
31+
- `-100 <= Node.val <= 100`

0 commit comments

Comments
 (0)