Pregunta de entrevista de AT&T

Weighted graph question, probably a Dijkstra-type problem.