Sort array in descending porder
arr = sorted ( arr ) NEW_LINE for i in range ( 0 , N // 2 ) : NEW_LINE INDENT t = arr [ i ] NEW_LINE arr [ i ] = arr [ N - i - 1 ] NEW_LINE arr [ N - i - 1 ] = t NEW_LINE DEDENT