You are given a permutation p of size n. You want to minimize the number of subarrays of p�hat are permutations. In order to do so, you must perform the following operation exactly once:
Select integers i, j, where 1≤i,j≤n, thenSwap pi and pj…