AlgoMaster Logo

787. Cheapest Flights Within K Stops

n=4,flights=[[0,1,100],[1,2,100],[2,0,100],[1,3,600],[2,3,200]],src=0,dst=3,k=1
0 / 27
Cheapest Flights Within K Stops (0 → 3)Initializing...10010010060020001230dist[]:00123Legend:UnprocessedSourceActiveDestinationUpdated
algomaster.io
Step:Initialize dist array: dist[0] = 0, all others = Infinity. Find cheapest price from 0 to 3 with at most 1 stops.