Divide by (x+3) repeatedly and stop when a remainder is nonzero. Synthetic division of 1,3,−7,−15,18 by −3 gives the row 1,0,−7,6 with remainder 0, so the quotient is x3−7x+6.
Divide again. Synthetic division of 1,0,−7,6 by −3 gives 1,−3,2 with remainder 0, so the new quotient is x2−3x+2.
Now test a third time.
(−3)2−3(−3)+2=9+9+2=20=0
The third division fails, so (x+3) divides exactly twice and the multiplicity is 2. In full, p(x)=(x+3)2(x−1)(x−2).