Puzzle | Human Zombie

This is a problem in which 4 people are their s1, s2, s3, s4 and there is a Bridge.These 4 people came to know that zombie will going to attack them after 17 minutes.Now the situation is like there is a lantern and at a time at most 2 people can cross the bridge but only with lantern and now here are the time that each person takes to cross bridge:

s1–> 1 minute
s2–> 2 minutes
s3–> 8 minutes
s4–> 10 minutes

Now we need to find out that whether is it possible that all 4 people will reach the other side of the bridge and cut the rope in 17 minutes.



Answer: YES

Explanation:
We need to sort them in ascending order of time i.e 1, 2, 8, 10 then we will send 1 & 2 so total time taken to cross bridge is 2 min and time to come back to start point by s1 is 1 min.
Now we will take next 2 i.e 10 & 8 minutes people and will send them so total time required would be 10 minutes
So overall its 1+2+10=13 minutes.
Now s2 with time of 2 sec will come back with lantern so total time is 13+2 minutes.
And then s1 & s2 will go back 15+2 minutes.

In this way everyone is able to cross bridge and then they will close the bridge.

This article is contributed by Kartik Jain. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.



My Personal Notes arrow_drop_up


Article Tags :
Practice Tags :


1


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.