We have to find LCM of 40, 42 and 45 to get the required minimum distance.
For this we find prime factorisations,
40 = 2 × 2 × 2 × 5
42 = 2 × 3 × 7
45 = 3 × 3 × 5
LCM (40, 42, 45) = 2 × 3 × 5 × 2 × 2 × 3 × 7 = 2520
Hence, Minimum distance each should walk 2520 cm. So that each can cover the same distance in complete steps.