In relativity, when can time dilation be used in opposed to length contraction?

You are right! Everything about your calculation is correct and well-stated.

Unfortunately, your teacher is wrong; they messed up the concept called relativity of simultaneity.

Imagine stationary buoys (in the Earth frame). Call them $\alpha$ and $\beta$. They are a distance $L$ apart. We will imagine that A passes buoy $\alpha$ at exactly the same time $B$ passes buoy $\beta$ in the Earth frame. Call the speeds of the rockets in the Earth frame $v_A$ and $v_B$.

From the frame of $A$, the distance between the buoys is $L/\gamma$. That's length contraction.

However, in the frame of $A$, the distance isn't the only thing that changes. Imagine the buoys have little clocks on them, and the clocks are synchronized in the Earth frame. Then A's frame, the clocks on the buoys are not synchronized. In fact, in A's frame, buoy $\beta$ has a time reading that is $Lv_A/c^2$ ahead of the other buoy's $\alpha$.

This is where your teacher's mistake came. They assumed that in $A$'s frame, the rockets passed the buoys simultaneously. That's wrong. In A's frame, when A gets to buoy $\alpha$, the clock on $\beta$ says $Lv_A/c^2$. That means $B$ already passed. It passed $\beta$ when its clock read zero, which was a time $\gamma Lv_A/c^2$ ago (due to time dilation of $\beta's$ clock in A's frame).

$\beta$ is approaching A at speed $v_A$ in A's frame. So in A's frame, when $B$ passed $\beta$ it was a distance $L/\gamma + v_A\gamma Lv_A/c^2$ away. That simplifies to $\gamma L$. So even though the buoys are length-contracted to be closer by a factor $\gamma$, in A's frame, when B passed $\beta$, it was further away than $L$ by a factor $\gamma$. (The buoys were still a distance $L/\gamma$ apart at that time according to A, but A hadn't reached $\alpha$ yet at the time B reached $\beta$, according to A.)

The time for rocket $B$ to get from $\beta$ to meet A is the distance it traveled divided by its speed in A's frame. Your teacher got the speed right, so that time is $\frac{L\gamma}{(v_A+v_B)/(1+v_Av_B/c^2)}$.

That was the time for B to get from $\beta$ to A in A's frame, but we want to know how long it is after A reaches $\alpha$, not how long after $B$ reaches $\beta$. We subtract the time $\gamma L v_A/c^2$ since that's the difference between those events in A's frame. Simplifying the algebra gives

$$t_A = \frac{L}{\gamma(v_A+v_B)}$$

That's the same as your solution. It took quite a bit of work to get there, so you probably don't want to do this "time delay from relativity of simultaneity" method a lot. On the other hand, your own solution was very straightforward, direct, and by using effects like time dilation, gives some extra insight into the problem you wouldn't get from using formal methods like Lorentz transformations to bash away at coordinates.

It's a good solution, and you had the right instinct to try to find out what specifically was wrong with the faulty method.

As a general rule I strongly advise students new to SR not to try and work by directly calculating time dilations or length contractions as it's easy to make mistakes. Indeed, Mark's answer shows how you teacher made exactly such a mistake by naively calculating the Lorentz contraction of the AB distance in A's frame. I recommend that the only safe way to proceed is to use the Lorentz transformations to calculate how spacetime points transform between the two frames.

The way I would set this up is so that A and B meet at the origin at time zero. The question doesn't say where the Earth is, so I'll put it at the origin as well. This way A and B and the Earth will agree on their positions and times at the moment all three meet. Then we just have to draw the positions at time $t = -2$ seconds:

Earth frame

At time $t = -2$ seconds we have $A$ at position $x = -3.6e8$ and moving with velocity $+0.6c$, and $B$ at position $x = +2.4e8$ and moving with velocity $-0.4c$. Then at time zero A and B will meet at the Earth.

Now, the Lorentz transformations are:

$$\begin{align} t' &= \gamma \left( t - \frac{xv}{c^2} \right ) \\ x' &= \gamma \left( x - vt \right) \end{align}$$

In the Earth frame the position of $A$ is $(t=-2, x=-3.6e8)$ so we feed this into the Lorentz tranformations to find the position of $A$ in $A$'s rest frame. We only want the time for this question, so taking the equation for $t'$ gives us:

$$ t' = 1.25 \left( (-2) - \frac{-3.6e8 \times 0.6c}{c^2} \right) = -1.6 \,\text{seconds} $$

And there's your answer. When the Earth clock shows $-2$ seconds the clock on $A$ shows $-1.6$ seconds. Since we've set things up so all observers agree that the meeting time is $t=0$ that means $A$ measures $1.6$ seconds to the meeting.

You can do the same calculation for $B$ and this gives the time measured by $B$ as about $1.77$ seconds.

Let's have a closer look at this to see what your teacher got wrong. To make the arithmetic easier I'll write the distances in light seconds, so our initial diagram looks like:

Light seconds

Note that we traditionally write the positions as $(t,x)$ so the position of A at time $t = -2$ seconds is $(-2, -1.2)$.

We have the three spacetime points marking the positions of A, E and B at time $t = -2$ seconds, So the next step is to feed these positions into the Lorentz transformations and find out where these points are in the rest frame of A. This is straightforward arithmetic so I'll just give the results:

$$\begin{align} A &= (-1.6, &0) \\ E &= (-2.5, &1.5) \\ B &= (-3.1, &2.5) \end{align}$$

As above we find the time for A is $t_A = -1.6$ seconds, which is how we now the time to the meeting is $1.6$ seconds. The position of A is $x_A = 0$ and of course that's correct - we've transformed to the rest frame of A and A is stationary at the origin of its own rest frame. So far so good.

But when we look at the position of the Earth we find something a bit odd. The Lorentz transformation has given us the position of the Earth at $t=-2.5$ seconds not $t=-1.6$ seconds as we found for A. This happens because events that are simultaneous in one frame are in general not simultaneous in another frame. But the transformation still makes sense. We know all observers meet at $(0,0)$ so that means in A's frame the Earth has to travel $1.5$ light seconds in $2.5$ seconds making its speed $v = 1.5/2.5 = 0.6c$, which is correct.

To find the position of the Earth at $t=-1.6$ seconds we just subtract the distance travelled in the time from $t=-2.5$ to $t=-1.6$ i.e. $0.9$ seconds. And at $0.6c$ that's $0.54$ light seconds. So at $t=-1.6$ the AE distance is $1.5 - 0.54 = 0.96$ light seconds.

Does this match with the Lorentz contraction calculated in the Earth frame? Well in the Earth frame the distance is $1.2$ and $\gamma=1.25$. Dividing the distance by $\gamma$ gives $0.96$ light seconds, and that's exactly what we calculated above. That's why your calculation gave the correct answer.

But now let's look at the position of $B$ after the transformation i.e. $(-3.1, 2.5)$. Again we know that all observers meet at $(0,0)$ so B has to travel $2.5$ light seconds in $3.1$ seconds, and that makes its speed $v'_B = 2.5/3.1 = 0.806c$. And that's the result your teacher got - OK so far.

But again we've calculated the position of B at the wrong time. We want its position at $t=-1.6$ not $t=-3.1$. So we subtract off the distance travelled, and that is just the time difference of $1.5$ seconds times the speed of $0.806c$ giving us $1.29$ light seconds. But your teacher took the distance in the Earth frame, $2$ light seconds and divided by the Lorentz factor of $1.25$ to get the distance $1.6$ light seconds, which is wrong. And that's why your teacher got the wrong answer.