This question evaluates algorithmic problem-solving and optimization skills, including modeling constrained state transitions, reasoning about trade-offs under a single shared resource, and minimizing aggregate cost.
A group of people must cross a bridge at night with one flashlight. The bridge can hold at most two people at a time.
Given an array t[] of crossing times (positive integers) for each person, compute the minimum total time needed for everyone to cross.
Clarify assumptions you will use (e.g., can people return, constraints on n, etc.) and describe an efficient algorithm.