Construct a $2022\times 2022$ matrix $A$ such that $A^{2022}=0$ but $A^{2021} \neq 0$
I want to construct a $2022\times 2022$ matrix $A$ such that $A^{2022}=0$ but $A^{2021} \neq 0$. More generally, I want to know how to construct a $n\times n$ matrix $A$ such that $A^n=0$ but $A^{n-1} \neq 0$. Any ideas?
One such matrix is $A=(a_{ij})$ where $$a_{ij}=\begin{cases} 0 & j\neq i+1\\ 1 & j=i+1 \end{cases}$$
The matrix with zeros in leading diagonal, ones in the super diagonal and zeros elsewhere is the matrix you want.
$A=(a_{ij})$, where $a_{ij}=0$, unless $j=i+1$, in which case $a_{i,i+1}=1$.