See attached graph.
Time taken by light pulse to travel from A to M,
dt1 = Lo/c
Time taken by light pulse to travel from M to A,
dt2 = Lo/c
total time in frame s,
dt = dt1 + dt2 = 2*Lo/c ...
The solution gives step-by-step working as well as a graph attached for visual aid in understand this question of an alternate derivation of the time dilation equation based on the travel of a light pulse along an axis.