The correct option is B 0.05 m
Analyze the situation carefully, you will notice that the spring is initially at its natural length but as you have given some initial velocity it to one of its objects, it will start compressing and simultaneously pushes the other one (up to a certain extent). Basically spring pushes the block A backward & block B forwards. Hence the velocity of block A decreases but of B increases. So a time comes when their velocities will be equal.
Now this the catch! their velocities will be equal...., actually means that there is no relative motion between the two. As initially, they are coming towards each other, now have no relative velocity. So this means that they will not come close nu further. which simply means this is the instant where max compression is...
Now rest follows:
There is no any external force acting on the system so momentum of 2 blocks system must be conserved.
m1u1=m1v+m2v
Get velocity 'v' from here than conserve energy
12m1u2=12m1v2+12m2v2+12k(x2)
Get x with substituting v=0.15㎧
Thus x=0.05m, thus option C