Solution (source code)

= Solution

A sufficient condition is that $A$ be a <standard graded algebra>: it is generated as a $k$-algebra by finitely many elements of degree one. The <Hilbert-Serre theorem> then makes $P_A(t)$ a rational function whose denominator, after cancellation, is a power of $1-t$. When the eventual Hilbert polynomial is nonzero,
$$
\deg h_A=\operatorname{ord}_{t=1}P_A(t)-1,
$$
where the right side uses the order of the pole at $t=1$.