Diameter of an Acyclic Undirected Graph
Given a connected, acyclic, undirected graph with n nodes—that is, a tree—whose nodes are labeled from 0 to n - 1, return its diameter. Each edge [u, v] in edges represents an undirected edg...
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:
