Avoiding Airports How to solve avoiding airports. I wrote a shortest distance approach using dijkstra but gives TLE. How to avoid going in loops to catch some flight at a particular node that leads to the destination. Can someone give a solution to this problem.
There will be no loops because you always catch a flight which is in future. So make a DP tracking last edge used and use convex hull trick(per node) for transitions.