Solution (source code)

= Solution

Use again the twisted <ideal-sheaf sequence of a projective hypersurface>. For $0<i<\dim Y=r-1$, the relevant part of its <long exact sequence in cohomology> is
$$
H^i(X,\mathcal O_X(n))\longrightarrow H^i(Y,\mathcal O_Y(n))
\longrightarrow H^{i+1}(X,\mathcal O_X(n-d)).
$$
Both outer terms are intermediate cohomology groups on $\mathbb P_k^r$, because $1\leq i<i+1\leq r-1$. They vanish by the <cohomology of twisting sheaves on projective space>. Therefore
$$
\boxed{H^i(Y,\mathcal O_Y(n))=0\qquad(0<i<\dim Y,\ n\in\mathbb Z).}
$$