Texas Instruments Interview Question

Dijkstra algorithm with a slight modification