Idea:
Let
$$A=\begin{bmatrix} -x & 1 & \dots & 1 \\ 1 & -x & \dots & 1 \\ \vdots & \vdots & \ddots & \vdots \\ 1 & 1 & \dots & -x \end{bmatrix}.$$
Then
$$A\begin{bmatrix}1\\1\\ \vdots \\1\end{bmatrix}=((n-1)-x)\begin{bmatrix}1\\1\\ \vdots \\1\end{bmatrix}.$$
Thus $(n-1)-x$ is an eigen value of $A$ so it divides the determinant.
Moreover we can think of $\text{det} A$ as an $n^{\text{th}}$ degree polynomial in $x$. An obvious root is $x=-1$ (because $\text{det} A\big|_{x=-1}=0$). Thus you have another factor of the determinant.
So far we have
$$\text{det} A=(x+1)(x-(n-1))p(x),$$
where $p(x)$ is some polynomial of degree $n-2$.
If $x \neq -1, n-1$ then try showing that the columns/rows are linearly independent so $\text{det} A \neq 0$. Thus the only roots of the determinant polynomial are $-1,n-1$. Now think about how to deal with multiplicity of the root $x=-1$ (hint: when $x=-1$, the $\text{rank}(A)=n-1$.)