# Four people A, B, C, D need to cross a bridge at night, and they have only one torch. The bridge is too dangerous to cross without a torch and is strong enough to support a maximum of two people at a time. They take 1, 2, 5 and 8 minutes respectively. What is the shortest time needed for all four of them to cross the bridge?

**Updated:**March 7, 2021 —

**Training Time:**2 minutes

Overseen by: Archangel Macsika

**Topic:** Data Science.

**Difficulty:** Easy.

**Companies who previously asked this:** -

**Objective:** Four people A, B, C, D need to cross a bridge at night, and they have only one torch. The bridge is too dangerous to cross without a torch and is strong enough to support a maximum of two people at a time. They take 1, 2, 5 and 8 minutes respectively. What is the shortest time needed for all four of them to cross the bridge?

**Short Answer: 15 minutes**.

### Full Solution

Let's lay out the data we have:

Person A takes 1 minute.

Person B takes 2 minutes.

Person A takes 5 minutes.

Person A takes 8 minutes.

Person B takes 1 minute.

First, Person A and Person B will cross the bridge in 2 minutes.

Total time taken so far: 2 minutes.

Person A crosses to the other side with the torch to meet Person C and Person D in 1 minute, while Person B remains on the other end.

Total time taken so far: 2 + 1 = 3 minutes.

Next, Person C and Person D cross the bridge in 8 minutes to meet Person B while Person A remains on the other end.

Total time taken so far: 3 + 8 = 11 minutes.

Next, Person B crosses the bridge alone to meet Person A in 2 minutes while Person C and Person D remains at the other end.

Total time taken so far: 2 + 11 = 13 minutes.

Finally, Person A and Person B to join Person C and Person D in 2 minutes.

Total time taken so far: 2 + 13 = 15 minutes.

Hence, the minimum time taken by them to cross the bridge is 15 minutes.