Arrays and Sorting Hackerrank challenge