  In this paper, we study the optimal constant in the nonlocal
Poincar\'e-Wirtinger inequality in $(a,b)\subset\mathbb R$: \begin{equation*}
\lambda_\alpha(p,q,r){\left(\int_{a}^{b}|u|^{q}dx\right)^\frac
pq}\le{\int_{a}^{b}|u'|^{p}dx+\alpha\left|\int_{a}^{b}|u|^{r-2}u\,
dx\right|^{\frac p{r-1}}}, \end{equation*} where $\alpha\in\mathbb R$, $p,q,r
>1$ such that $\frac 45 p\le q\le p$ and $\frac q2 +1\le r \le q+\frac q p$.
This problem can be casted as a nonlocal minimum problem, whose Euler-Lagrange
associated equation contains an integral term of the unknown function over the
whole interval of definition. Furthermore, the problem can be also seen as an
eigenvalue problem.
  We show that there exists a critical value $\alpha_C=\alpha_C (p,q,r)$ such
that the minimizers are even with constant sign when $\alpha\le\alpha_{C}$ and
are odd when $\alpha\geq \alpha_{C}$.
