Kottke just posted the infamous rope-burning interview problem, which is actually quite easy:
You are given two ropes and a lighter. This is the only equipment you can use. You are told that each of the two ropes has the following property: if you light one end of the rope, it will take exactly one hour to burn all the way to the other end. But it doesn’t have to burn at a uniform rate. In other words, half the rope may burn in the first five minutes, and then the other half would take 55 minutes. The rate at which the two ropes burn is not necessarily the same, so the second rope will also take an hour to burn from one end to the other, but may do it at some varying rate, which is not necessarily the same as the one for the first rope. Now you are asked to measure a period of 45 minutes. How will you do it?
The solution is the following:
- Light rope #1 at one end
- Light rope #2 at both ends
- When rope #2’s ends meet, light rope #1 at the other end. 30 minutes have been measured so far, leaving 30 minutes left on rope #1.
- When rope #1’s ends meet, fifteen minutes have been measured, for a total of 45 minutes.
|This entry was posted on Wednesday, November 22nd, 2006 at 10:56 pm and is tagged with . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.|