the way to do this is to use relative velocity

let's say the bee is on the left car

imagine that car two is stationary, the bee will then be moving towards car two at a rate of 30 km/h (20+10)

while car one is moving towards car two at a rate of 10+10 km/h, or rather 20km/h

so what was mentioned earlier is right, everytime the bee reaches another car, the distance remaining is 1/3 of the original before they started moving

this is because everytime it starts from one side, the bee takes 2/3 of the time the two cars need to cover to reach each other to reach the other car due to faster speed

by gp,

first time - 1/3 km distance left

second time - 1/9 km distance left

third time - 1/27 km distance left

fourth time - 1/81 distance left

and so and so forth

so this is a stupid question, since even when distance between the two are minutely small, the bee is flying faster than the two cars' relative motion to each other.

even if distance left is 0.01cm between the two when the bee has reached one of the two cars, the bee is just buzzing very fast in between the two

answer is simply related to the amount of time taken for the two cars to meet, i.e. 1/20 hour or 3 minutes. because once they meet, confirm the bee gone case.

in this three minutes, the bee can only fly 20/20 km = 1 km. because it is travelling at constant speed.

but if you want the number of times the bee is going to be able to move back and forth in between, amazingly, it seems like the answer is infinite.