\(=x^3-3x^2+6x^2-18x+8x-24\\ =\left(x-3\right)\left(x^2+6x+8\right)\\ =\left(x-3\right)\left(x^2+2x+4x+8\right)\\ =\left(x-3\right)\left(x+2\right)\left(x+4\right)\)
\(x^3+3x^2-10x-24=\left(x^3-3x^2\right)+\left(6x^2-18x\right)+\left(8x-24\right)=x^2\left(x-3\right)+6x\left(x-3\right)+8\left(x-3\right)=\left(x-3\right)\left(x^2+6x+8\right)=\left(x-3\right)\left[\left(x^2+2x\right)+\left(4x+8\right)\right]=\left(x-3\right)\left[x\left(x+2\right)+4\left(x+2\right)\right]=\left(x-3\right)\left(x+2\right)\left(x+4\right)\)