This is the solution to Codility's is permutation challenge.