a) \(\left(x+3\right)\left(x^2-3x+9\right)-x\left(x-2\right)^2=27.\)
\(\Leftrightarrow x^3+27-x\left(x^2-4x+4\right)-27=0.\)
\(\Leftrightarrow x^3-x^3+4x^2-4x=0.\)
\(\Leftrightarrow4x\left(x-1\right)=0.\)
\(\Leftrightarrow\left[{}\begin{matrix}4x=0.\\x-1=0.\end{matrix}\right.\Leftrightarrow\left[{}\begin{matrix}x=0.\\x=1.\end{matrix}\right.\)
Vậy \(S=\left\{0;1\right\}.\)