Tree Diameter
Try to solve the Tree Diameter problem.
We'll cover the following
Statement
Given an undirected tree with edges
where
The diameter of a tree is the number of edges in the longest path between any two nodes.
Constraints:
n
edges.length
edges[i].length
= 21
0
Examples
Level up your interview prep. Join Educative to access 70+ hands-on prep courses.