Center of a Tree
Medium
Tree Diameter & Distances
Print the centre node of a tree (the middle of its diameter). If the diameter has an even number of edges the centre is unique; for this problem inputs always have a unique centre.
Constraints
1 <= n <= 10^5
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.