Skip to content

Instantly share code, notes, and snippets.

@etorreborre
Created October 9, 2012 22:12
Show Gist options
  • Save etorreborre/3861764 to your computer and use it in GitHub Desktop.
Save etorreborre/3861764 to your computer and use it in GitHub Desktop.
"U2" has a concert that starts in 17 minutes and they must all
cross a bridge to get there. They stand on the same side of the
bridge. It is night. There is one flashlight. A maximum of two
people can cross at one time, and they must have the flashlight
with them. The flashlight must be walked back and forth. A
pair walk together at the rate of the slower man's pace:
Bono 1 minute to cross
Edge 2 minutes to cross
Adam 5 minutes to cross
Larry 10 minutes to cross
For example: if Bono and Larry walk across rst, 10 minutes have
elapsed when they get to the other side of the bridge. If Larry then
returns with the flashlight, a total of 20 minutes have passed and you
have failed the mission.
// Scroll down
Bono and Edge cross first and Bono comes back = 3 minutes
Adam and Larry cross and Edge comes back = 12 more minutes -> 15 minutes
Bono and Edge cross = 2 more minutes -> 17 minutes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment