Hello TA
I am solving this beautiful vertices problem. I looked at the hint and understood it and tried to solved it. The sample test case is passing but it is giving WA on hidden Test Case, kindly look into the code and tell me what I am doing wrong
Code: https://ide.codingblocks.com/s/240658
Thank you
Implemented the Video Explanation but WA on Submit
@hargovind
add the edges in form of bidirectional edges because the input can be any form.
Also, in dfs function move these 2 lines inside the if condition of vis[nbr] :-
children[src]++;
parent[nbr] = src;
You can have a look at this corrected code link https://ide.codingblocks.com/s/242028
1 Like
Yeah It worked. Thanks!