<s>[INST] How to calculate the determinant of all-ones matrix minus the identity? How do I calculate the determinant of the following $n\times n$ matrices
$$\begin {bmatrix}
0 & 1 & \ldots & 1 \\
1 & 0 & \ldots & 1 \\
\vdots & \vdots & \ddots & \vdots \\
1 & 1 & ... & 0
\end {bmatrix}$$
and the same matrix but one of columns replaced only with $1$s?
In the  above matrix all off-diagonal elements are $1$ and diagonal elements are $0$.
 [/INST] $$D_n(a,b)=
\begin{vmatrix}
a & b & b & b \\
b & a & b & b \\
b & b & a & b \\
b & b & b & a
\end{vmatrix}$$
($n\times n$-matrix).
$$D_n(a,b)=
\begin{vmatrix}
a & b & b & b \\
b & a & b & b \\
b & b & a & b \\
b & b & b & a
\end{vmatrix}$$
$$=[a+(n-1)b]
\begin{vmatrix}
1 & 1 & 1 & 1 \\
b & a & b & b \\
b & b & a & b \\
b & b & b & a
\end{vmatrix}$$
$$=[a+(n-1)b]
\begin{vmatrix}
1 & 1 & 1 & 1 \\
0 & a-b & 0 & 0 \\
0 & 0 & a-b & 0 \\
0 & 0 & 0 & a-b
\end{vmatrix}$$
$$=[a+(n-1)b](a-b)^{n-1}
$$
(In the first step we added the remaining rows to the first row and then "pulled out" constant out of the determinant. Then we subtracted $b$-multiple of the first row from each of the remaining rows.)
You're asking about $D_n(0,1)=(-1)^{n-1}(n-1)$.

If you replace one column by 1's, you can use this result to get the following. (I've computed it for $n=4$, but I guess you can generalize this for arbitrary $n$.)
$$
\begin{vmatrix}
1 & 1 & 1 & 1 \\
1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 \\
1 & 1 & 1 & 0 \\
\end{vmatrix}
=
\begin{vmatrix}
0 & 1 & 1 & 1 \\
1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 \\
1 & 1 & 1 & 0 \\
\end{vmatrix}
+
\begin{vmatrix}
1 & 0 & 0 & 0 \\
1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 \\
1 & 1 & 1 & 0 \\
\end{vmatrix}=
\begin{vmatrix}
0 & 1 & 1 & 1 \\
1 & 0 & 1 & 1 \\
1 & 1 & 0 & 1 \\
1 & 1 & 1 & 0 \\
\end{vmatrix}
+
\begin{vmatrix}
0 & 1 & 1 \\
1 & 0 & 1 \\
1 & 1 & 0 
\end{vmatrix}
$$
Note that both these determinants are of the type you already handled in the first part.
</s>