Absolute Permutation Hackerrank Solution Python