Implements isPermutation() solution to problem 1.3