The ratio of speeds of A and B is 3 : 5. So, by the time bus A travels 375 km, bus B would have travelled 625 km. So, the first time that the two buses meet when travelling in opposite directions is at a distance of 125 km from city Y. Time taken for this meeting from the start of the journey = 6.25 hours.
For the two buses to meet again while moving in the opposite direction, they should first reach the two opposite ends and then again meet somewhere in the middle. Hence, together they should cover 2*500km = 1000 km.
Time taken to cover 1000 km while they are moving in opposite direction = 1000 / (100kmph + 60kmph) = 1000/160 hrs = 6.25 hrs.
Thus, from the first meeting, the two buses will meet each other while travelling in opposite directions every 6.25 hours.
Therefore, if they travel infinite number of times, they meet at 6.25hr, 12.5hrs, 18.75hrs, 25 hrs etc.
Distance covered by B for each time period is 6.25*100 km, 12.5*100km, 18.75*100km, 25*100 km etc i.e. 625km, 1250 km, 1875 km, 2500 km etc.
But we know that B travels only 2 times between X to Y and Y to X. So max distance travelled by B is 4*500 km = 2000 km
Hence, A and B will meet at 3 points corresponding to the following distances travelled by B => 625km, 1250km, 1875km.
The first point of meeting is (625 mod 500) = 125 km from Y.
The second point of meeting is (1250 mod 500) = 250 km from Y i.e. mid point of X and Y.
The third point of meeting is (1875 mod 500) = 375 km from Y
This is the final meeting between the two buses. Bus B comes to rest before the next meeting between the buses can take place. So, the answer is 3.