Bumblebee

problem: two trains enter a tunnel 200 miles long (yeah, its a big tunnel) travelling at 100 mph at the same time from opposite directions. as soon as they enter the tunnel a supersonic bee flying at 1000 mph starts from one train and heads toward the other one. as soon as it reaches the other one it turns around and heads back toward the first, going back and forth between the trains until the trains collide in a fiery explosion in the middle of the tunnel (the bee survives). how far did the bee travel?


Solution

solution: this puzzle falls pretty high on my aha scale. my first inclination when i heard it was to think “ok, so i just need to sum up the distances that the bee travels…” but then you quickly realize that its a difficult (not impossible) summation which the interviewer could hardly expect you to answer (unless i guess if you are looking for a job as a quant). “there must be a trick” you say. eh, sort of i guess, enough to say that this question is a stupid interview question.

the tunnel is 200 miles long. the trains meet in the middle travelling at 100 mph, so it takes them an hour to reach the middle. the bee is travelling 1000 mph for an hour (since its flying the whole time the trains are racing toward one another) – so basically the bee goes 1000 miles.

there is no process to explain, so this question can’t possibly teach you anything about the person. they either know it or they don’t and if they already knew it before you asked, you’re not going to be able to tell when they give you the answer. so don’t ask this question. and if someone asks you this question, just tell them you’ve already heard it before.

2026 Update: The Bee Problem — Infinite Series vs. Direct Insight

Classic puzzle: Two trains 100 miles apart approach each other at 50 mph each. A bee starts at one train and flies back and forth at 75 mph until the trains collide. How far does the bee fly total?

Wrong approach (but common): Sum an infinite geometric series of the bee’s trips.

Right approach (direct insight): The trains close at 100 mph combined, so they meet after 1 hour. The bee flies for 1 hour at 75 mph = 75 miles.

def bee_simulation(train_distance=100, train_speed=50, bee_speed=75, dt=0.001):
    """
    Numerically simulate the bee's path.
    Returns total distance flown.
    """
    pos_a = 0          # Train A starts at 0, moves right
    pos_b = train_distance  # Train B starts at 100, moves left
    bee_pos = 0        # Bee starts at Train A
    bee_dir = 1        # +1 = right, -1 = left
    bee_total = 0.0
    t = 0

    while pos_a = pos_b:
            bee_pos = pos_b
            bee_dir = -1
        elif bee_dir == -1 and bee_pos <= pos_a:
            bee_pos = pos_a
            bee_dir = 1

    return bee_total

simulated = bee_simulation()
analytical = 75.0  # bee_speed * (train_distance / (2 * train_speed))

print(f"Simulated:  {simulated:.2f} miles")   # ≈ 75.00
print(f"Analytical: {analytical:.2f} miles")  # 75.00

# General formula
def bee_distance(d, v_train, v_bee):
    """Total distance bee flies."""
    time_to_collision = d / (2 * v_train)
    return v_bee * time_to_collision

print(bee_distance(100, 50, 75))   # 75.0
print(bee_distance(200, 40, 100))  # 250.0

The John von Neumann story: This puzzle is famously told about von Neumann, who solved it instantly. When told “most people try to sum the series,” he said “What else would you do?” — suggesting the direct method is obvious. The puzzle tests whether you recognize when to step back from calculation and think about what’s actually being asked. In system design terms: before optimizing, make sure you’re solving the right problem.

💡Strategies for Solving This Problem

Path Optimization and Movement Constraints

Got this at Citadel in 2023. It's about a bumblebee flying between two trains moving toward each other. Tests understanding of relative motion, series, and when to use simulation vs math.

The Problem

Two trains are 100 miles apart, heading toward each other at 50 mph each. A bumblebee starts at one train, flies toward the other at 75 mph. When it reaches the second train, it turns around and flies back. It keeps doing this until the trains meet. How far does the bumblebee fly?

The Trap

Most people try to calculate each leg:

  • First leg: fly to approaching train
  • Second leg: fly back
  • Third leg: fly forward again
  • Sum infinite series...

This works but is complex. There's a much simpler approach.

Approach 1: Simulate Each Leg (Hard Way)

Calculate distance for each leg as trains get closer. Sum them up.

First leg:

  • Trains approach at combined 100 mph
  • Bee flies at 75 mph toward train
  • Relative closing speed: 75 + 50 = 125 mph
  • Initial distance: 100 miles
  • Time to meet train: 100/125 hours
  • Bee distance: 75 × (100/125) = 60 miles

Then calculate second leg with new train distance... Gets messy fast.

Approach 2: Think About Time (Elegant) ✓

Key insight: The bee flies for exactly as long as it takes the trains to meet.

How long until trains meet?

  • Distance: 100 miles
  • Combined speed: 50 + 50 = 100 mph
  • Time: 100/100 = 1 hour

Bee flies at 75 mph for 1 hour = 75 miles

That's it! No infinite series needed.

Why This Works

Doesn't matter how many times the bee turns around. It's constantly flying (no rest) until trains meet. Total flight time = time for trains to meet.

The Simulation (For Verification)

We can simulate to verify:

  1. Track train positions
  2. Track bee position and direction
  3. Update each timestep
  4. When bee reaches train, flip direction
  5. When trains meet, stop and report distance

At Citadel

I started working on the geometric series. Interviewer let me struggle for a minute, then said "Think simpler. How long is the bee flying?" Immediately clicked. He said "Good interviewers sometimes let you find the simple answer yourself, but we don't want to waste time. The elegant solution is what we're looking for."

Scroll to Top