Fog Creek Software
Discussion Board

Railroad Bridge

First, is it a bridge or a tunnel?  I shall call it a brunnel.

Here is my solution, which may well be incorrect.

Let d be the distance between the train and the end of the brunnel.  Let l be the length of the brunnel.  Then dude is l/4 from the same end of the brunnel as the train.  Let vt be the velocity of the train and vd be the velocity of dude.

It is given that dude can arrive at the end of the brunnel nearer the train at the same time the train will arrive there.  Therefore, l/4vd=d/vt.

It is also given that dude can arrive at the far end of the brunnel at the same time as the train.  Therefore, 3l/4vd=(d+l)/vt.

Finally, we know that dude (and the train) travel the same speed no matter which way dude runs, so we know that the second equation equals three times the first equation.  Therefore, 3d/vt=(d+l)/vt.

Solving this system of equations, we find that vt/vd=2.  The train is traveling twice as fast as dude.  Either dude is a sprinter or the train takes it slow while approaching brunnels.

So...Is this an appropriate interview question?  It is a Physics 100 problem.  I am shockingly bad at correctly solving most of these puzzles, but since I've studied physics, this problem was relatively straightforward for me.

Similarly, since probability is so counter-intuitive, probability questions like the Cars On The Road problem are much better indicators of whether a person has studied probability than whether that person is a generally capable problem solver. 

A specific example: Paul Hoffman writes in The Man Who Loved Only Numbers (a very entertaining biography of Paul Erdos, which I recommend to probably anyone who would read this web site) that when Marilyn vos Savant posed the solution to the Monty Hall Dilemma, well-respected mathematicians wrote in from all over the country telling her that she could not possibly be right (though of course she was).

I find that people answer most probability questions correctly if and only if they have studied probability problems.  Thus this is a great metric if you're writing time series prediction software or whatnot, but otherwise, what does it tell you about general problem solving ability?

I would certainly be impressed if someone uninitiated in the domain were to attack a probability question or a physics question (or any other question whose solution is straightforward if and only if one has studied the relevant domain) with enough care and clarity to arrive at a solution, but I would not expect it.  Do others?  Are my standards unrealistically low?  Am I just making a long-winded case to make myself feel less stupid?

Friday, December 31, 2004

Provided that the question does not demand specialist knowledge then one would expect a sufficiently talented candidate to make a good attempt at solving it.

For example, the Monty Hall problem can be solved by visualising the problem in the right way and does not really require performing any calculations at all.

The calculations are usually written down to convince people who can't 'see' the solution.

Ofcourse, the question is what counts as specialist knowledge ? For example, would Pythagoras' Theorem count as specialist knowledge ? I would argue not, but where do you draw the line ?

Anyway, this particular question can be solved without any knowledge of physics.

To make the arithmetic easier, assume the length of the tunnel is 4 (lenght units).

The man is 1/4 of the distance into the tunnel and therefore the ratio of his distance from the two ends of the tunnel is 3 : 1

Let d be the distance between the train and tunnel.

Then the ratio of the train's distance form the two ends of the tunnel will be 4 + d : d

But these two ratios must be equal if the train's speed is a constant multiple of the man's speed, therefore:

(4 + d)/d = 3/1

Which can be resolved as

d = 2

Now that we've got the location of the train, it is easy to see that speed of the train will be twice that of the man. For example, by noting that to meet at the nearest end of the tunnel at the same time, the man will have to travel one unit and the train will have to travel to units in the same time period.

Sajid Umerji
Friday, December 31, 2004

In the final sentence above I meant to type:

... and the train will have to travel TWO units in the same time period.

Sajid Umerji
Friday, December 31, 2004

How about this solution: since the man is 1/4 inside the tunnel, if he goes away from the train it will be at 1/2 when the train reaches the tunnel (during the time it takes the train to reach the tunnel, the man can travel 1/4 of the tunnel), and because they both reach the other end at the same time, it means the train travels twice as fast...

Monday, January 3, 2005

In response to M, I would say that probability problems are totally appropriate, precisely because they're unintuitive.  Most readers here are concerned with interviews for computer programming jobs.  Computer programming is inherantly unintuitive.  You need to sit down and draw pictures to make sense of it.  Similarly, if you sit down and draw pictures and have a rudimentary understanding of probability, you can solve any probability problem.

The important thing that interviewers look for is, "Does the interviewee sit down and draw pictures and thing logically, through a process, or does he go with [blind] intuition?"  A tenacious, analytical problem solver (which the interviewer is looking for), even without probability background, will do well enough with probability problems, if he draws pictures, presents an idea, and backs it up.

You can't go with intuition most of the time in programming, or engineering, or medicine, or, well, most anything analytical.  Even if you'd be safe 9/10 of the time, screwing up is often quite costly in jobs requiring analytical problem solving skills.

Friday, January 7, 2005


first of all lets assume that the man is running away from the train. irrespective of whether the man runs towards
the train or away from it the train shall reach the entrance of the tunnel after 1 sec. the man at this point of time has already come halfway through the tunnel.
so in 2 sec he has to cover half the lenght of the
tunnel and the train the entire lenght of the tunnel.
hence the man is half as fast as the train.

Thursday, January 27, 2005

Well I don't know much of anything about physics.
The problem is very simple though.

First given is that when the man runs back he reaches the exit together with the train.
So when the man travels 1/4th of the tunnel the train is at the beginning of the tunnel.

With this knowledge you know that if the man runs to 1/2 of the tunnel the train is at the beginning of the tunnel.
They excit at the same time. Thus train travels the tunnel in the time the man runs 1/2 of the tunnel.

--> train is twice as fast as the man.
Which would make the speed of the train well somewhere around 40 km/h

Thierry Schellenbach
Saturday, March 12, 2005

*  Recent Topics

*  Fog Creek Home