LET'S TALK TECHNICAL

This blog is intended to help people prepare for the job interviews and improve their analytical skills. We have posted difficult datastructures and algorithm questions and puzzles. Interview experiences section is for the people to post their interview experiences.Views expressed here are of their personal and the blog author doesn't take any responsibility for the same.

-

Followers

Jobs

Wednesday, December 5, 2007

Four people crossing the bridge optimally

Four people need to cross a rickety rope bridge to get back to their camp at night. Unfortunately, they only have one flashlight and it only has enough light left for seventeen minutes. The bridge is too dangerous to cross without a flashlight, and it is only strong enough to support two people at any given time. Each of the campers walks at a different speed. One can cross the bridge in 1 minute, another in 2 minutes, the third in 5 minutes, and the slow poke takes 10 minutes to cross. How do the campers make it across in 17 minutes?

Sol:
When two people walk and their speeds are different then the time taken(cost) to cover some distance will be the time taken by slowest of the two.

first take 1, 2 to side2 cost = 2
get 2 back to side1 cost = 2
then take 5,10 to side2 cost = 10
get 1 back to side 1 cost = 1
get 1 and 2 back to side2 cost =2

total cost = 17

No comments:

Post a Comment

Popular Posts