Sir, i have used BFS to solve the problem. Where am i wrong in my logic? i am traversing using bfs and finding if the vector size (adjacency list) of the neighbour node is greater or not. If greater simply ans++ and i have considered all disconnected component too. please help
My Solution–https://ide.codingblocks.com/s/75261
Beautiful Vertices Problem
for every connected component , start a dfs from the smallest node and store who is the parent and number of children while tranversing .
finally count all the children and parent pair
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.