Sufficient and necessary conditions for $f,g$ such that $\Bbb F_m/(f) \cong \Bbb F_m/(g)$

Consider the polynomial ring $\Bbb F_m[x]$, and two polynomials $f,g $ in $\Bbb F_m[x]$.

Is there any necessary and sufficient conditions for $f,g$ such that
$\Bbb F_m[x]/(f) \cong \Bbb F_m[x]/(g)$?

Or if there are two particular $f,g$ in $\Bbb F_m[x]$, how to check that the quotient rings generated by $f,g$ are isomorphic? I have this question when I encounter the following question:

Are $\Bbb F_3[x]/(x^3+x^2+x+1), \Bbb F_3[x]/(x^3-x^2+x-1) $
isomorphic?

I could not see a suitable isomorphism so I assume they are not isomorphic, yet cannot come to a contradiction so far.

Any help for the two problems is appreciated, thanks.

Solutions Collecting From Web of "Sufficient and necessary conditions for $f,g$ such that $\Bbb F_m/(f) \cong \Bbb F_m/(g)$"