Beautiful vertices


test cases failing

Hello @Bansaljatin05,

Your code is failing for the test cases like:
4 3
3 2
3 1
4 3
Expected Output:
1
Your Output:
0

Modify your code for the same.

Hint:
Rather using BFS, Try to solve this problem using DFS only.

Hope, this would help.
Give a like if you are satisfied.

1 Like

https://ide.codingblocks.com/s/199925 please see now what is the problem

Hey @Bansaljatin05,

I didn’t mean this modification.

Refer to the following code for better understanding:

Hope, this would help.

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.