General term of the expansion (a + x)n is ,
Tr+1 = nCr an-r xr = ((n(n-1)(n-2)....(n-r+1))/r!) an-r xr.
The general term ((r + 1)th term) is
(x2 - 3a/x)15 = 15Cr(x2)15-r (-3a/x)r =(-1)r 15Cr x30-2r (3rar/xr) =(-1)r ​ 15Cr 3r ar x30-3r
If this term contains x24, then 30-3r = 24
3r = 6
r = 2.
Therefore, the coefficient of x24 = 15C2 9a2=945a2