Reputation: 4232
I faced one competition, where I got stuck in one question. Please help me in this.
Starting point - 0. Ending Point - N.
Contraints :-
If we are at node i, and that node has numbers of children, then we can only move to smallest index node from node i.
Tell me the minimum numbers of edges that I have to delete to reach from 0 to N.
I am totally stuck in this. Please answer.
Upvotes: 0
Views: 69
Reputation: 65498
Set the cost of each arc to the number of arcs with the same tail whose head has a smaller index. Run your favorite shortest path algorithm.
Upvotes: 3