This is a solution to problem 23 on the hard interview questions node. If you have not read the question, the following will make no sense to you:

It is easiest to think of everything relative to the stream.

Say the woman meets the log at 12:00, then paddles away from it until 1:00, at which point she paddles toward it at the same speed. Clearly she will reach the log again at 2:00.

So two hours have elapsed, during which time the log (which travels with the current), has travelled one mile to the dock. Thus the current is travelling at 1/2 mph.


dtaylor: what I meant by "constant" was that, for example, the woman doesn't start to paddle faster at any point... of course, when she turns around, she has to change her speed, but we assume this is an instantaneous change and she continues paddling at the same speed in the other direction. This is all in the spirit of the principle of well-constructed examples: if it starts to get ugly, you've strayed from the intended path.

daleks: I guess the problem statement is a little ambiguous on this point, but the woman does not necessarily paddle upstream for a total of 2 hours, or 2 miles. She paddles upstream for one mile, then one hour.