not able to understand the question even after reading the editorial
Beautiful vertices
A node is considered a beautiful if the number of children of that node is greater than the number of children of its parent node.Master parent cannot be a beautiful vertex.
Consider a test case:
5 4
1 2
1 3
3 4
3 5
Expected Output:
0. Here node 3 is not beautiful because node 3 has 2 children and its parent 1 also has 2 children.
Idea is to do DFS for each component. Store number of child for each node in a map. Also make a parent map and then check for the condition.
You can refer this https://ide.codingblocks.com/s/265351