Hard Problemsminimizationlinear
Program for Bridge and Torch problem
A group of people, each with a different crossing speed, must get across a bridge at night sharing one torch; at most two people can cross together and they move at the slower one's pace, and the torch must be carried back for anyone else to cross. Find the minimum total time for everyone to reach the other side.
Note. This problem is typically solved with a greedy argument about the two fastest and two slowest crossers; the DP formulation shown here is the derivable, table-based alternative.
Do this lesson first: coin changeThe full breakdown and animated table for this problem are still being written. In the meantime, run the four questions on it yourself — that is the whole exercise.