cant find my mistake…getting WA for both test cases
Beautiful verticesss
firstly make the graph undirecte if nothing is given in the question then graph is undirected
also smallest value will serve as the master pareant
10 6
2 1
2 3
2 4
6 5
5 7
5 9
in this example ans is 2 but ur code giving 1
as 2 is not yhe parent of 1 instead 1 is parent of 2 smallest value
Read question once carefully
this is written in ques
In any connected component of the graph, vertex with the lowest value in that component serves as the master parent.
in this thread u said that edges are directional…and if edges are undirected then the number of children and parents will always be same i think
please reply asap…its been 3 days i created this thread
once sort the values and then check
but we have to take the edges directed or undirected…and if undirected then tell me how will we choose which one is parent and which one is child in the pair
take it directed there r 2 question on beautiful vertices i got confused between them i open the wrong question in that we have to take undirected
here taken directed and sort to find the master parent
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.