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.
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 minutes 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 write.geeksforgeeks.org or mail your article to email@example.com. 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.