The thought experiment I am referring to in this question is similar to this: https://aether.lbl.gov/www/classes/p139/exp/experiment5.html
Essentially, let the length of the light clock be $d$ metres and the constant velocity of the train be $v$ metres per second. Let's say we want to find the time taken for the clock to complete one 'tick' (ie. from one end of the clock to the other and back) from the perspective of a stationary observer on the ground.
One method could be to find the time taken for the clock to tick in the moving frame of reference, and then consider the effect of time dilation with the equation $t ={\gamma}{t_0}$, where $\gamma=\frac{1}{\sqrt{1-\frac{v^2}{c^2}}}$. This yields the equation $T=\frac{2d\gamma}{c}$.
I also thought that considering the effect of length contraction on the length of the clock perceived by the stationary observer and then multiplying this value by two and dividing it by the speed of light would also be a valid method. However this returns a different equation, being $T=\frac{2d}{c\gamma}$, with the Lorentz factor instead being in the denominator.
I have a feeling that my second method is incorrect, potentially because the stationary observer cannot experience length contraction. However, also don't quite believe that to be a valid contradiction, as it would be no different if the observer was instead travelling toward a stationary train at $v$ metres per second. Is my reasoning valid, or is there some other misconception that I am overlooking?