15/45= 1/3 (hours) =20 (minutes)
At this time, B left.
5* 1/3=5/3 (km)
The rest of the journey is equal to the opposite direction of the teacher and B.
Let the time be x.
X*(5+45)= 15-5/3
X=4/ 15 (hours) = 16 (minutes)
Then the teacher went back (with B)
Time is still 16 minutes.
Total 20+ 16+ 16 = 52 minutes.