It is known that a polynomial $P$ with integer coefficients has degree $2022$. What is the maximum $n$ such that there exist integers $a_1, a_2, \cdots a_n$ with $P(a_i)=i$ for all $1\le i\le n$?
[Extra: What happens if $P \in \mathbb{Q}[X]$ and $a_i\in \mathbb{Q}$ instead?]
We have $a_i-a_{i-1}\mid P(a_i)-P(a_{i-1})=1$ so $a_i-a_{i-1}\in \{1,-1\}$. Since $a_i\ne a_j$ it follows that $a_{i+1}=a_i+1$ or $a_{i+1}=a_i-1$.
WLOG it's former because if latter holds, $P(c-x)$ is true for former.
The answer is $2022$. Construction: $P(x)=x+\prod\limits_{j=1}^{2022} (x-j)$.
Proof of optimality: Since $P(x)-x+c$ vanishes at 2023 consecutive points, call $a,\cdots,a+2022$ it is $Q(x) \prod\limits_{j=a}^{a+2022} (x-j)$. If this is nonzero, $\deg P\ge 2023$. Otherwise, $\deg P=1$. Both contradict $\deg P=2022$, so we are done.