you give integer n you initially permutation perm size n permi 0indexedin operation create new array arr iIf 2 0 arri permi 2if 2 1 arri permn 2 1 2you assign arr permReturn minimum nonzero number operation need perform perm return permutation initial value Example 1input n 2output 1explanation perm 01 initiallyAfter 1st operation perm 01So take 1 operationexample 2input n 4Output 2Explanation perm 0123 initiallyAfter 1st operation perm 0213after 2nd operation perm 0123So take 2 operationsexample 3input n 6output 4 Constraints2 n 1000n