Wrong output eventhough my own test cases are passing

Im getting wrong output for Beautiful vertices problems.

@vishal23rfx
Please send your code on CB IDE

@vishal23rfx
Your code is adding unidirectional edges
They are bidirectional
Please correct that

How it affects the overall output?Can u give me a simple testcase for which my code fails so that I can understand better?

@vishal23rfx
The issue arose because you’re assuming input will have u < v
So either add bidirectional edges
or first make sure u < v
And then add edges

I changed the code but still getting wrong answer

I have updated the code in cb ide also

@vishal23rfx
I saw the rest of your code and it seems perfect
Must be a small issue that I’m missing somewhere
Please cross verify your code with this code

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.

Thanks .I understood my mistake

1 Like