An array of integers p1,p2,....,pnp_1,p_2,....,p_np1,p2,....,pn is called a permutation if it contains each number from 111 to nnn exactly once. For example, the following arrays are permutations: [3,1,2],[1],[1,2,3,4,5][3,1,2], [1], [1,2,3,4,5][3,1,2],[1],[1,2,3,4,5] and [4,3,1,2][4,3,1,2][4,3,1,2]. The following arrays are not permutations: [2],[1,1],[2,3,4][2], [1,1], [2,3,4][2],[1,1],[2,3,4].

This is a companion discussion topic for the original entry at https://toph.co/p/permutation-query