Tree Diameter

Tree Diameter

Given an undirected tree with n nodes labeled from 0 to n - 1, and an edges array of length n - 1 where edges[i] = [u, v] denotes an undirected edge between nodes u and...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: