The next Codility challenge I will be covering is the IsPermutation challenge in chapter 2. The question can be seen in the gist below:

The question asks us to return 1 if an inputted array is a permutation, or 0 if it is not a permutation. As we know, a permutation is an array of elements containing all elements from 1..n, once and only once. Using that, we know that an array will fail any tests if an element is less than 0, or greater than the lengths of the array. We also know that if an element appears more than once, it is not a permutation. A good solution to checking if an element has already been encountered is to use a counter. Either a boolean or an integer counter would be appropriate, as long as it is possible to determine if an element has been checked before. My solution can be found below, I scored 100% correctness and 100% performance:

As always, check out the Git for this problem.