Interview Question

Software Engineer Interview(Student Candidate) San Antonio, TX

A train leaves San Antonio for Huston at 60mph. Another

  train leaves Huston for San Antonio at 80mph. Huston and San Antonio are 300 miles apart. If a bird leaves San Antonio at 100mph, and turnes around and flies back once it reaches the Huston train, and continues to fly between the two, how far will it have flown when they collide.

Interview Answer

14 Answers


Find out how long it will take the two trains to collide, then multiply that number by the birds flying speed.

Interview Candidate on 2010-05-02

There are several scenarios to consider.

Scenario 1 - Since trains rarely collide, the bird will hypothetically continue to fly forever, thus the answer is infinity miles. However, this is obviously not a rational outcome since the bird will tire, need to stop for nourishment, and require rest. In addition, one would need to know more about the bird such as the average lifespan and the realistic length of time the bird can fly at a sustained speed of 100 miles per hour. Of course, the term "bird" is sometimes used colloquially when referring to an airplane.

Scenario 2 - Assuming both trains leave at the exact same moment, then the distance between them will be reduced by 140 miles per hour, which is the combined speeds of both trains. Therefore, it will take (300/140) = 2.14 hours before the two trains collide thus the bird would have flow (2.14*100) = 214 miles. However, this assumes both trains are traveling at a constant speed on a single track void of any modern collision avoidance systems, and that neither train makes any scheduled stops along the way, which again is not a real world scenario. Of course, the only bird capable of flying 100 mph sustained for more than 2 hours is an airplane.

Scenario 3 - Assuming I am interviewing for an upper level management position and solving the problem will significantly impact the company's bottom-line and thus impact my bonus, I would hire a management consulting company specializing in mathematic modeling to solve the problem and offer suggestions to optimize the collision such that it would conserve as much energy as possible for both trains and the bird.

Einstein on 2010-12-31

Where is Huston, Texas? I didn't see it on the map. The only city that I see approx 300 miles of San Antonio is Houston.

So since there is not Huston then there is no train and hence no collision. The bird flies till it dies.

JumpingJackFlash on 2010-12-31

If the bird is flying between both trains when they collide, it won't have flown at all anymore since it would be dead (squashed between both trains).

Hanksta on 2011-01-11

They won't collide; they're on separate tracks to stop this happening.

Andrew on 2011-01-11

Too far... that bird needs better navigational skills. Try a GPS.

Furry on 2011-01-11

Actually, it needs some math and some imagination only.
First of all, the collision point will be about 128.6 miles from San Antonio and the collision should happen after 128.6 minutes.

Part 1: The bird will start travelling from San Antonio heading to Huoston and will meet the Huoston train after 2 Hrs and 40 Minutes (Relative speed between both is 180 mph) at a point which is 167 miles away from San Antonio and 133 miles far from Huoston. At this moment, the San Antonio Train will be 100 miles from San Antonio and 67 miles away from both the bird and Huoston train.
The bird has flown 167 miles

Part 2: The bird will fly back towards San Antonio train again at a relative speed between them of 160 mph and will meet the train after another 25 minutes at a point which is 125 miles from San Antonio. At this moment, the Houston train will be 133.5 miles from San Antonio and 8.5 miles from both the San Antonio Train and the bird.

Part 3: The bird will fly again towards Huoston Train, and will reach it after about 3 minutes at a point which is almost the collission point.

Previous "rough" calculations tells us that the bird has travelled a distance of almost 218 - 220 miles.

I hope this is the right answer though.

Ahmed on 2011-01-11

Train 1: x = 0, v = 60 mph
Train 2: x = 300, v = -80 mph
Bird: x = 0, v = 100mph

300 + (-80*t) = 0 + (100*t) -> t = 1.667
(60 * 1.667) = 100
(100 * 1.667) = 166.67

Train 1: x = 100, v = 60 mph
Train 2: x = 167.7, v = -80 mph
Bird: x = 167.7, v = -100mph

100 + (60*t) = 167.7 + (-80*t) -> t = .476 h
(-100 * .476 ) = 47.6

Bird, total distance is 214.3 miles, or a displacement of 119.0 miles from its starting location.

Steven on 2011-01-11

When who collides? The bird and the train or the trains?

Blank on 2011-01-11

If the bird is literally "flying between the trains" until they collide.. Then, the answer is "not far enough to get out of the way before being squashed."

Rob on 2011-01-11

100*(300/(60+80)) = 1500/7 miles. It takes 300/(60+80) hours for the trains to collide, and the bird will travel at 100 mph during this time.

Jay on 2011-01-11

The fastest flier in the world is the Peregrine Falcon. It can reach a "flat" speed of 124 mph (dives have been clocked at 168), but I do not believe any known bird can maintain 100mph when flying on an even plane for more then a few miles. So the birds quits, there is an opening. Whats It Pay?

adriver on 2011-01-11

The distance is infinite as there is no relaxation time or turning time so such a thing is not possible practically. For an instance imagine the distance traveled by the bird when the distance between the two trains is just 10m and so on till 8 9 7 till the distance is just tending to 0.

Sandeep on 2012-06-26

Here’s how to think about it so you can do it in your head:

The 2 trains are closing in on each other at 60 mph + 80 mph = 140 mph.
The have to cover 300 miles before they collide.
They will collide in 300miles/140 mi/hr = 30/14 = 15/7 hours = 2-1/7 hours (a little over 2 hours).

The bird is flying at 100 mph for 15/7 hours. The bird flies 100 mi/hr x 15/7 hours = 1500/7 miles.
That is a little over 214 miles.

Ballpark Reality Check: Trains crash in a little over 2 hours so the bird flies at 100 mph for a little over 2 hours which is a little over 200 miles. Yep, sounds right.

Nothing else matters. Not how far the trains go, not how far the bird goes, not what direction the bird is flying, etc. Answer the question that was asked and don’t answer a question that wasn’t asked. The question is, “How far does the bird travel?” The answer is “Exactly 1500/7 miles which is a little over 214 miles.”

Delta II on 2012-08-21

Add Answers or Comments

To comment on this, Sign In or Sign Up.