Solution for Permutations.