I knew the specific instance from somewhere in the back of my brain, the answer is 17 minutes, but I fumbled explaining WHY for a solid two minutes.
First, solve the specific instance by reasoning about the optimal strategy: the two slowest should cross together, and the fastest should shuttle the flashlight. Then, generalize by identifying the two candidate strategies (using the two fastest as shuttlers or using the fastest to escort the slowest) and choosing the cheaper one at each step, leading to a dynamic programming or greedy solution.
Pro tip: After presenting the solution, mention that this problem illustrates the importance of considering trade-offs between using the fastest person as a shuttle versus pairing slowest together, a common pattern in optimization problems.
Work through the 1,2,5,10 case to find the minimum time (17 minutes) and the sequence: 1 and 2 cross (2), 1 returns (1), 5 and 10 cross (10), 2 returns (2), 1 and 2 cross (2).
For any four people sorted by time, the optimal is either: (a) fastest shuttles: t1+t2 cross, t1 returns, t3+t4 cross, t2 returns, t1+t2 cross; or (b) fastest escorts: t1+t4 cross, t1 returns, t1+t3 cross, t1 returns, t1+t2 cross.
Sort times ascending. For the two slowest, compute the cost of both strategies and pick the cheaper. Remove them and repeat until 3 or fewer remain, then handle base cases.
Use a greedy approach: while n>3, compare cost1 = t1 + 2*t2 + tn and cost2 = 2*t1 + t_{n-1} + tn, add the smaller to total, and reduce n by 2. For n=3, total = t1+t2+t3; for n=2, total = t2; for n=1, total = t1.
Sorting takes O(n log n), and the loop runs O(n) times, so overall O(n log n) time and O(1) extra space.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.