1245. Tree Diameter
Last updated
Last updated
**Input:** edges = [[0,1],[0,2]]
**Output:** 2
**Explanation:**
A longest path of the tree is the path 1 - 0 - 2.**Input:** edges = [[0,1],[1,2],[2,3],[1,4],[4,5]]
**Output:** 4
**Explanation:**
A longest path of the tree is the path 3 - 2 - 1 - 4 - 5.