At maximum extension of the spring, velocities of both blocks will be same.
Conservation of momentum:
6*2.2 – 3*1.8 = (3+6)*V
V = 0.867 m/s
Conservation of energy:
1/2*3*1.8*1.8 + 1/2*6*2.2*2.2
= 1/2*(6+3)*0.867*0.867 + 1/2*512* X*X
X = 0.25 m = 25 cm