# This code for journey to moon dint work .pls help

can you tell me y u used the formula… ans=ans+ c*(v-c);

@aparna181

c is number of nodes in current connected components right?

that means v-c are the nodes that are not in current connected nodes right?

so if i pick one node form c and one node from v-c there will be no path between them and that is what we want.

so total how many such pairs possible?

it will be c * (v-c)

I hope I’ve cleared your doubt. I ask you to please rate your experience here

Your feedback is very important. It helps us improve our platform and hence provide you

the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen

the doubt.

accepted all testcases in hackerrank

thx @aman212yadav

we counting twice each pair acc to your logic