Longest Path in a Tree
Easy · Longest Path in a Tree
You are given the `root` of a binary tree. A path is a chain of nodes where neighbours are joined by an edge and no node appears twice. Its length is the number of edges it contains. Return the length of the longest path between any two nodes of the tree. The path does not have to pass through the root.…
Solve the problem →