Function to reverse1 the subarray
function reverse1 ( left , right , arr ) { while ( left < right ) { let temp = arr [ left ] ; arr [ left ] = arr [ right ] ; arr [ right ] = temp ; ++ left ; -- right ; } }