As we know the cycle travels from A to B and comes back from B to A so let the distance be x km.
Then, given speed₁ = 30 km/hr and speed₂ = 20 km/hr
therfore, time₁ = d/s = x/30 and time₂ =x/20
so Average speed = total distance/total time
=x + x/ x/30 + x/20
on solving i get 24 km/hr....................hence solved..