Big Sorting Hackerrank Solution Python