Problem 3203 · Hard

Find Minimum Diameter After Merging Two Trees

Joining two trees by one edge gives a diameter found from the two diameters alone: the larger of them, or the two radii plus one.

Open the interactive visualisation