Length of the Longest Connected Path

Правка en1, от AaZaDi, 2020-05-19 19:11:45

Can someone explain how to find the length of the longest connected path in a graph. I have tried using the common technique, of finding the most distant node(leaf node) from any node and then find the most distant node from this leaf node using dfs twice. This is my code, don't know why this is giving RE.

Code

[problem:Problem] https://www.spoj.com/problems/PT07Z/

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский AaZaDi 2020-05-19 19:13:00 318
en1 Английский AaZaDi 2020-05-19 19:11:45 1778 Initial revision (published)