Hello Friends,

I have a question. I am not getting what to do in it.

Please help me with the approach :-

Problem :-

Given a directed graph having ‘N’ nodes with starting point at node ‘1’ and given an integer ‘M’. You have to add minimum no. of directed edges to the graph so that every node can be reached in atmost ‘M’ steps from the starting node ‘1’.

Input :-

First line :- N & M

Next N Lines :- Two integers a,b that represent an edge from node ‘a’ to node ‘b’

Constraints :- 2<=N<=10^5

1<=M<=10^4

1<=a,b<=N

Output :-

Output the minimum no. of edges to add in the graph so that every node can be reached in atmost ‘M’ steps from the starting node ‘1’.