PAIRING - Doubt


why is code failing the test-cases the output seems to be right ?

Hi
Your logic seems to be incorrect
For:
5 3
0 1
1 3
0 4
Your answer should be 6, as 3 cannot be reached by 2,4 {(3,2) (3,4)} and 2 cannot be reached by 0,1,3,4 {(0,2)(1,2)(3,2)(4,2)}
But your answer is 2
Pls rectify your code accordingly