Find a polynomial $f(x)$ of degree $5$ such that both of these properties hold: $\bullet$ $f(x)$ is divisible by $x^3$. $\bullet$ $f(x)+2$ is divisible by $(x+1)^3$.
Since f(x) is divisible by x^3, f(x) is of the form ax^5 + bx^4 + cx^3.
You then want ax^5 + bx^4 + cx^3 + 2 to be divisible by (x + 1)^3. Using long division, you get the equations
-10a + 6b - 3c = 0
4a - 3b + 2c = 0
-a + b - c + 2 = 0
==> a = 6, b = 16, c = 12
So f(x) = 6x^5 + 16x^4 + 12x^3.