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.