Gaussian elimination, the definition of determinant and the fact for a upper-triangular matrix the determinant is the product of the values on the principal diagonal, give other way in order to find the $|A|$ where $A=[a_{ij}]\in M_{n\times n}({\bf R})$ is a matrix defined by the law $$a_{ij}=\begin{cases}(-1)^{|i-j|},\quad i\not=j,\\2,\quad i=j\end{cases}$$
Firstly, the control of the row exchanges (permutations $\pi$) can be done with the signum, which we denote as ${\rm sgn}(\pi)$. Now, the determinant of the $n\times n$ matrix is given by
\begin{align*}&=\begin{vmatrix}2&-1&1&-1&1&\cdots\\-1&2&-1&1&-1&\cdots\\1&-1&2&-1&1&\cdots\\-1&1&-1&2&-1&\cdots\\1&-1&1&-1&2&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&2\end{vmatrix}={\rm sgn}(\pi)\begin{vmatrix}-1&2&-1&1&-1&\cdots\\2&-1&1&-1&1&\cdots\\1&-1&2&-1&1&\cdots\\-1&1&-1&2&-1&\cdots\\1&-1&1&-1&2&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&2\end{vmatrix}\\
&={\rm sgn}(\pi)\begin{vmatrix}\boxed{-1}&2&-1&1&-1&\cdots\\2&-1&1&-1&1&\cdots\\0&1&1&0&0&\cdots\\0&0&1&1&0&\cdots\\0&0&0&1&1&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&1 \end{vmatrix}={\rm sgn}(\pi)\begin{vmatrix}-1&2&-1&1&-1&\cdots\\0&\boxed{3}&-1&1&-1&\cdots\\0&1&1&0&0&\cdots\\0&0&1&1&0&\cdots\\0&0&0&1&1&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&1\end{vmatrix}\\
&={\rm sgn}(\pi)\begin{vmatrix}-1&2&-1&1&-1&\cdots\\0&1&1&0&0&\cdots\\0&\boxed{3}&-1&1&-1&\cdots\\0&0&1&1&0&\cdots\\0&0&0&1&1&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&1 \end{vmatrix}={\rm sgn}(\pi) \begin{vmatrix}-1&2&-1&1&-1&\cdots\\0&1&1&0&0&\cdots\\0&0&\boxed{-4}&1&-1&\cdots\\0&0&1&1&0&\cdots\\0&0&0&1&1&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&1 \end{vmatrix}\\
&={\rm sgn}(\pi)\begin{vmatrix}-1&2&-1&1&-1&\cdots\\0&1&1&0&0&\cdots\\0&0&1&1&0&\cdots\\0&0&\boxed{-4}&1&-1&\cdots\\0&0&0&1&1&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&1 \end{vmatrix}={\rm sgn}(\pi)\begin{vmatrix}-1&2&-1&1&-1&\cdots\\0&1&1&0&0&\cdots\\0&0&1&1&0&\cdots\\0&0&0&\boxed{5}&-1&\cdots\\0&0&0&1&1&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&1 \end{vmatrix}\\
&={\rm sgn}(\pi)\begin{vmatrix}-1&2&-1&1&-1&\cdots\\0&1&1&0&0&\cdots\\0&0&1&1&0&\cdots\\0&0&0&1&1&\cdots\\0&0&0&\boxed{5}&-1&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&1 \end{vmatrix}={\rm sgn}(\pi)\begin{vmatrix}-1&2&-1&1&-1&\cdots\\0&1&1&0&0&\cdots\\0&0&1&1&0&\cdots\\0&0&0&1&1&\cdots\\0&0&0&0&\boxed{-6}&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&1 \end{vmatrix}\\
&={\rm sgn}(\pi)\begin{vmatrix}-1&2&-1&1&-1&\cdots\\0&1&1&0&0&\cdots\\0&0&1&1&0&\cdots\\0&0&0&1&1&\cdots\\0&0&0&0&1&\cdots\\\vdots&\vdots&\vdots&\vdots&\vdots&\boxed{(-1)^{n}(n+1)} \end{vmatrix}\\&={\rm sgn}(\pi)(-1)(-1)^{n}(n+1)\\&={\rm sgn}(\pi)(-1)^{n+1}(n+1)
\end{align*}
Thus $\det(A)={\rm sgn}(\pi)(-1)^{n+1}(n+1)$.
- If $n$ is odd number, we have ${\rm sgn}(\pi)=1$. Thus, $\det(A)=n+1$.
- If $n$ is even number, we have ${\rm sgn}(\pi)=-1$. Thus. $\det(A)=n+1$.
Therefore, $\det(A)=n+1$.