Problem 1245 · Medium
Sweep the tree from any node to find one end of a longest path, then sweep again from that end.
Open the interactive visualisation