I think your second data set is wrong because cycles like (5,2) are not allowed according to the problem description.
Thanks this helped me fix the issue. In my case I did a mistake my topological sort implementation.
Thank you, you helped me with this user case.
For me it was the search of “root” which was incorrect. So i was using the wrong root, so ofc i get a wrong diameter (i used “node 1” instead of “node 9”).
my solution doesn’t pass the test cases, however it passes all the tests when I submit. I think the problem (or the tests, might be poorly designed)
Hi ! Does anyone know what the “Arbitrary indexes” test is about? This is the only one failing for me, and I have no idea why…thanks!