Solution (source code)

= Solution

The sharp <Poincaré inequality for the uniform distribution on an interval> is
$$
\operatorname{Var}(f(U))\leq\frac1{\pi^2}\mathbb E[f'(U)^2],
\qquad U\sim\operatorname{Unif}[0,1].
$$
Tensorizing these $n$ identical one-dimensional inequalities gives
$$
\operatorname{Var}(f(X))
\leq\frac1{\pi^2}\mathbb E\lVert\nabla f(X)\rVert^2
$$
for the uniform distribution on $[0,1]^n$. Therefore one may take $c=1/\pi$; this value is sharp, as functions depending only on one coordinate attain the one-dimensional constant.