-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsinking_island.txt
21 lines (15 loc) · 1.24 KB
/
sinking_island.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
Sinking Island
You and 3 friends are partying it up on your private island late one night when all of a sudden the sirens go off. The island is sinking. The only way off the island is by walking across an old wooden bridge which can only support the weight of 2 people at a time. Since its night time you'll want to make sure 1 of the 2 people crossing the bridge brings a flashlight so you don't accidentally walk off the bridge. Unfortunately you only have 1 flashlight.
Some of your friends move slower than others. For example, if you want to cross the bridge with Friend C it will take 5 minutes because you can't leave them behind without the flashlight. Here is the time chart of how long it takes each friend to cross.
You - 1 minute
Friend B - 2 minutes
Friend C - 5 minutes
Friend D - 10 minutes
What's the fastest time everyone can get off the island?
Solution:
If you escort all your friends off yourself it will take 19 minutes.
Is there a way we can get the slowest 2 friends to cross at the same time and increase our throughput?
You and B go over first, you leave B and go back for C and D (3 min roundtrip)
C and D go at the same time and B comes back to you with the flashlight (12 min roundtrip)
You and B cross again (2 min trip)
17 minutes total