https://online.codingblocks.com/app/player/65729/content/154766/5018/code-challenge
Here what is the answer for the following test cases:
3
0 0 1 1
2 0 1 1
1 1 1 2
And also in this test case:
4
0 0 1 1
2 0 1 1
1 1 1 2
1 3 1 5
Since both these test cases have a component that is a wheel graph. Do we have to add a seperate edge for return to the centre of the wheel graph or not. If we dont have to then i believe the solution is no. Of components-1