while loop to swap all smaller numbers to arr1
def getMedian ( ar1 , ar2 , n ) : NEW_LINE INDENT i , j = n - 1 , 0 NEW_LINE while ( ar1 [ i ] > ar2 [ j ] and i > - 1 and j < n ) : NEW_LINE INDENT ar1 [ i ] , ar2 [ j ] = ar2 [ j ] , ar1 [ i ] NEW_LINE i -= 1 NEW_LINE j += 1 NEW_LINE DEDENT ar1 . sort ( ) NEW_LINE ar2 . sort ( ) NEW_LINE return ( ar1 [ - 1 ] + ar2 [ 0 ] ) >> 1 NEW_LINE DEDENT