Pregunta de entrevista de ServiceNow

Question in Round 3 on graphs and shortest path