Interview Question

Software Engineer Interview Research Triangle Park, NC

Two trains, each moving at 20 miles per hour towards each

  other, are initially 60 miles apart. A bee starts at the front of one train, flies to the other train, then back to the first train, and so on. If the bee always flies at 30 miles per hour, how far does the bee fly before the trains collide?
brain teaser

Interview Answer

5 Answers


45 miles. He was laid back about this question and wanted to see me thinking about it more than getting it right.

Interview Candidate on Dec 13, 2012

time of collision=30/20=1.5hr
distance fly by the bee= 30X1.5= 45miles

Ramy Soliman on Dec 16, 2012

45 miles is the wrong answer. The end points for the bee are constantly changing, so you can't just say 30X1.5

Math Whiz on Feb 24, 2013

@72min ..the bee collides with first train and starts traveling back @30miles/hour...when trains are 6 miles apart from collision point..
@90 min the collision bee has 18min to travel from its collision in opposite 30mph * 18/60 = 9 miles towards collsion point(which is 6 miles apart).
So it will be far by 3 miles.

Ashwin on Mar 16, 2013

Other possibly correct answers:

- The bee would die from the sudden impact with train 2 in 72 minutes after flying a total of 36 miles.

- Oh you mean these bees have mastered inertialess flight - forget about the job and give me one of those to study!

That aside...

The one thing everyone left out of the answer was that enough information wasn't actually supplied to answer it 100% accurately and it has nothing to do with the fact that the two endpoints are moving. The issue is that while the 45 miles number may be "close enough" - to be 100% accurate you have to calculate the total number of traversals the bee can make in the time allotted and subtract it's body length 1 time for each of those traversals from the total.

Michael on Apr 7, 2014

Add Answers or Comments

To comment on this, Sign In or Sign Up.