Permutations 2

Same as N-Queens. As for duplicates, start from the max index + 1.