Fog Creek Software
Discussion Board




railroad bridge

http://www.techinterview.org/Puzzles/railroadbridge.html

Let's assume that there are 2 persons in the tunnel, instead of one and that they run at the same speed, one-fourth from the tunnel entrance.

The first person turns around and runs towards the entrance, covering one-fourth of the tunnel length. At the same time the second person runs towards the exit of the tunnel with the same speed. By the time the first person reaches the entrance, the train is there; the second person is at the mid-point of the tunnel.

By the time the second person reaches the exit of the tunnel, covering one-half the tunnel length, the train would have covered the length of the tunnel and just misses him.

So, the train's speed is twice that of the man's.

smnaha
Monday, June 03, 2002

good work, thats a cool way to solve it without
a pen

Cheradenine Zakalwe
Wednesday, June 05, 2002

Assuming the man starts running the instant the whistle blows, the train must blow its whistle when it's half a tunnel length away from the entrance:
let Y be the distance from the train's start position to the entrance, and X be the distance from the man's start position to the entrance.  We know that these are covered in the same time.
Therefore, when the man runs for the exit (distance 3X), this takes 3 times as long, so the train must cover distance 3Y, which is the same as Y + (length of tunnel), so Y=1/2(length of tunnel), so Y=2X, and the train is going twice as fast as the man.

David Ackermann
Wednesday, June 05, 2002

I used Time as my basic measurement:

Let A = beginning of tunnel
Let B = end of tunnel

1.  Assume that Train must be going faster than Man.
2.  (Man's top speed) x (1/4 tunnel) = x units of time (I know, time = distance/speed;  this is just how I'm organizing my thoughts).
3.  Time for Train to reach A from its starting position is "x" units of time.
4.  Time for Train to reach B from its starting position is 3x units of time (same as for Man to reach B from his 1/4 of tunnel position).
5.  Therefore, it takes the train 2x units of time to travel from A to B
6.  If Man traveled from A to B, it would take 4x units of time
7.  Therefore, it takes the train half as long to travel A to B;  the Train must be twice as fast

I know it's more complicated than the above solutions, but it made sense to me at the time.

Andreas Udby
Friday, June 14, 2002

No one offered the brute force equations.  Same answer, more work, less thought!

R_m : speed of the guy
R_t: speed of the train
d: 1/4 length of tunnel
x: dist from train to tunnel

  R_m T = d
    R_t  T = x
3  R_t T = x + 4d

Solve:
3 R_t T = R_t T+ 4 R_m T
    r R_t = 4 R_m
      R_t = 2 R_m

The train is twice as fast as the guy.

mitchell perilstein
Monday, June 17, 2002

*  Recent Topics

*  Fog Creek Home