A and B are travbeling in the same direction

A is 40 miles
B is 60 miles

if a passes @ 12:20am and B passes @ 12:35am what time will B catch up to A?

I assume you mean A's speed is 40 mph and B's speed is 60 mph

If A is 15 minutes ahead of B when they pass the checkpoint, A has gone 10miles ahead of B when B gets there.

SO, B has to make up 10 miles, but he's going 20mph faster than A, so it will take him 1/2 hour to catch up.

That will be at 12:35 + :30 = 1:05 am

What are they doing walking in the middle of the night?