Solution (source code)

= Solution

Interpolation means $p_n(x_i)=f(x_i)$ for every node. Define the <Lagrange basis polynomials>
$$
\ell_i(x)=\prod_{j\ne i}\frac{x-x_j}{x_i-x_j}.
$$
Distinctness of the nodes makes every denominator nonzero, and $\ell_i(x_j)=\delta_{ij}$. Thus
$$
\boxed{p_n(x)=\sum_{i=0}^nf(x_i)\ell_i(x)}
$$
is a <polynomial> of degree at most $n$ with the required values. If two such polynomials existed, their difference would have $n+1$ distinct roots while having degree at most $n$; the <polynomial> root bound makes it identically zero. Hence existence and uniqueness hold. The actual degree can be smaller than $n$, despite the conventional name.