Change the rule, keep the loop
transcript
A ride costs its steepest step. Not the sum of its steps. Can Dijkstra still work? Yes, if you check one thing. Change one line, keep the loop.
Take the smallest entry. Skip it if it is stale. Relax the roads that leave it. None of this depends on addition.
Steps of a ride: one, two, three, two, one. The cost is the largest step so far. It rises to three. It never falls. The rest stay below three. The ride costs three. The sum of the steps would be nine.
A sum adds the step. A steepest step takes the larger. The loop around it does not change.
One check keeps it correct. A step must never lower the cost. Then the smallest entry is final. Any other way costs no less.
Name the cost of a route. Check that a step never lowers it. Keep the same heap loop. Full breakdown in the lecture.