There are two insects on a tile. Insect X is sitting on one side of the tile (point A) and Insect Y is sitting opposite on the other side of the tile (point B). Now both of them decide to change their position and thus X starts crawling to point B and Y starts crawling to point A. When they meet and pass each other in between, X takes 20 seconds to reach to B and Y takes just 5 seconds to reach A.

Can you calculate the total time each of the insects took to change their positions?

Assume that P is the speed of Insect X and Q is the speed of Insect Y.

Let T be the number of seconds it takes them to cross paths.

Now Distance = Speed * Time

Thus for Insect X

Distance = P * T before meeting

And Distance = P *20 after meeting

For Insect Y

Distance = Q * T before meeting

And Distance = Q * 5 after meeting

Now the distance travelled by X before meeting is equal to the distance travelled by Y after meeting and vice versa

Thus

P * T = Q * 5

And Q * T = P * 20

Solving both equations, we get T = 10

Thus Insect X requires 10 + 20 = 30 seconds,

Whereas Insect Y requires 10 + 5 = 15 seconds to change the position.