|
0
Wow, thanks a lot. I understood it. Also I was thinking instead of reversing( or getting the last vertex of bfs) we could sort the nodes in each component based on the degree of that node. Will this work? Upd : Yea Its working, Thank you Igorjan94 :) |
|
0
From guitarhero_0221 's comment test case, I realized that we can't directly remove any node from the non-complete-component. We should first check if removing a node from this component still preserve the connections between other nodes in the same component. But, why does reversing the component fix the solution? |
|
0
Sorry I meant "complete components" instead of Strongly connected. I just realized step 4 is wrong. But step 5 is still correct because in the counter-example you have given a tree that is not a complete component. So the answer is 1 from step 2. I still claim that my approach is correct ignoring step 4. |
|
0
Why is my solution getting WA for problem E? My Logic:
Please correct me if my approach is not correct. |