Step 1: What does same direction mean.
Two velocity vectors point the same way when they have the same slope, that is the same ratio of vertical part to horizontal part. So our goal is to make these two ratios equal and solve for time.
Step 2: Velocity parts of the first body.
It is thrown at $u_1 = 15\sqrt3$ at $60^\circ$. The horizontal part stays fixed, the vertical part drops with gravity. \[ v_{1x} = 15\sqrt3\cos60^\circ = \frac{15\sqrt3}{2} \] \[ v_{1y} = 15\sqrt3\sin60^\circ - 10t = \frac{45}{2} - 10t \]
Step 3: Velocity parts of the second body.
It is thrown at $u_2 = 40$ at $30^\circ$. \[ v_{2x} = 40\cos30^\circ = 20\sqrt3 \] \[ v_{2y} = 40\sin30^\circ - 10t = 20 - 10t \]
Step 4: Set the two slopes equal.
\[ \frac{\frac{45}{2} - 10t}{\frac{15\sqrt3}{2}} = \frac{20 - 10t}{20\sqrt3} \] To clear the half, write the top of the left side as $\dfrac{45 - 20t}{2}$ and combine.
Step 5: Cross multiply and simplify.
After clearing fractions the $\sqrt3$ cancels on both sides. \[ 20(45 - 20t) = 15(20 - 10t) \] \[ 900 - 400t = 300 - 150t \]
Step 6: Solve for time.
Bring the $t$ terms together and the numbers together. \[ 600 = 250t \] \[ t = 2.4\,\text{s} \] \[ \boxed{2.4\,\text{s}} \]