Incomprehensive test cases


There are 2 issues:

  1. Java Editorial solution is incorrect. It checks for cycles in an un-directed graph, so it will return 0 for the following case:
    3 1 1 3
    3 2 3 2

  2. Incomprehensive test cases: The Editorial solution still passes all the tests although it failed the above case.
    My solution returns 1 for the above case and it also passes all test cases.


Exactly… C# editorial solution is also incorrect.