McAfee interview question

A question based on Dijkstra's algorithm