Cyber attack some test cases failed

some test cases are failing,
can anyone tell me wher i am going wrong

Hello @nkysy713,
I think you need to sort your extra vector after the maximum spanning tree is formed.

sort(extra.begin(),extra.end());

Currently, your elements in the extra vector are stored in decreasing order and you are iterating in the wrong direction.

1 Like

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.

1 Like