Sort the arrays and check results are equal to determine if there's a permutation