# Interview Questions

Ritambhara Technologies - Coding Interview Preparations > Interview Questions > Logic > Puzzles > Crossing the Bridge in 17 min, Puzzle

# Crossing the Bridge in 17 min, Puzzle

There is a bridge that will collapse in 17 minutes. 4 people (A, B, C and D) are standing on one side of the bridge and want to cross it before it collapses. There are few restrictions, as below:

- It’s dark, so you can’t cross the bridge without a torch(flashlight), and there is only one torch.
- The bridge is only big/strong enough for 2 people to cross at a time.
- All 4 people walk at different speeds.

– A takes 1 minute

– B take 2 minutes

– C take 5 minutes, and

– D takes 10 minutes

to cross the bridge.

- When two people cross the bridge together (sharing the torch), they both walk at the speed of slower person.

How can they all get across before the bridge blows up (i.e cross the bridge in 17 minutes)?

### Solution:

Solution to the problem is as follows:

Move |
Time |

A & B Cross with torch | 2 |

A Return with torch | 1 |

C & D Cross with torch | 10 |

B Return with torch | 2 |

A & B Cross with torch | 2 |

———————— | ————– |

Total Time | 17 |

Please send me the c++ logic for this puzzle