Approach hintTry it first, then revealHide
Fill the permutation position by position while marking which elements are already used; record the path once its length reaches n, and clear the mark when backtracking.
Fill the permutation position by position while marking which elements are already used; record the path once its length reaches n, and clear the mark when backtracking.