Sorry if I caused misunderstandings.
We need to repeat the operation (finding $s$ and appending $s$ to the end of $a$) until all the numbers from $[1,n]$ excluding $k$ can be formed, instead of doing the operation once.
Sorry if I caused misunderstandings.
We need to repeat the operation (finding $s$ and appending $s$ to the end of $a$) until all the numbers from $[1,n]$ excluding $k$ can be formed, instead of doing the operation once.