The question and its answer is given below:
But I do not know how I should think to find all the invariant subspaces and why the answer is as mentioned above, could anyone explain this for me please?
Edit:
I found an answer to this question here find invariant subspace of polynomials but still I do not understand the answer, could anyone clarify this answer for me please? at least the intuition behind it and the general idea.
Thank you!


Here's a sketch of a solution (so as to not give everything away) :
If $V$ is an invariant subspace, let $x^n+q(x)$ be some element of $V$, with $\deg q < n$. By using some translation, show that there is $x^n+p(x)\in V$ with $\deg p<n-1$.
Again using some translation, deduce that there is $x^n+x^{n-1}+r(x)\in V$ for some $r$ with $\deg r < n-1$. Conclude that some $x^{n-1} + h(x) \in V$ with $\deg h < n-1$. By induction, deduce that there is a constant in $V$, then by going back up, deduce that for $k\leq n$, $x^k\in V$
Conclude.