← Questions

Bridge and torch problem

0
NvidiaCodingLast asked Jan 2026

People must cross a bridge at night with one flashlight. At most two cross at once, a pair moves at the slower person's speed, and someone has to bring the flashlight back. Given everyone's crossing time, return the minimum total time. Sort the times and compare the two ways of moving the two slowest people across at each step.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding