Folosind metoda backtracking se generează toate matricele pătratice de dimensiune 4 cu elemente din mulțimea {0, 1} cu proprietatea că pe fiecare linie și pe fiecare coloană există un unic element egal cu 1. Știind că în șirul matricelor generate primele 6 matrice sunt în ordine:
$\begin{pmatrix}0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\\ 1 & 0 & 0 & 0\end{pmatrix},$ $\begin{pmatrix}0 & 0 & 0 & 1\\ 0 & 0 & 1 & 0\\ 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\end{pmatrix},$ $\begin{pmatrix}0 & 0 & 0 & 1\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\\ 1 & 0 & 0 & 0\end{pmatrix},$ $\begin{pmatrix}0 & 0 & 0 & 1\\ 0 & 1 & 0 & 0\\ 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 0\end{pmatrix},$ $\begin{pmatrix}0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\\ 0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\end{pmatrix},$ $\begin{pmatrix}0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 1 & 0\end{pmatrix}$
pe ce poziție în șirul matricelor generate este matricea de mai jos (pozițiile se numerotează de la 1)?
$$\begin{pmatrix}0 & 0 & 1 & 0\\ 0 & 1 & 0 & 0\\ 0 & 0 & 0 & 1\\ 1 & 0 & 0 & 0\end{pmatrix}$$