Find the most significant index and the most significant digit to be swapped
if ( diff1 > 0 or diff2 > 0 ) : NEW_LINE INDENT if ( diff1 > diff2 ) : NEW_LINE INDENT arr1 [ i ] , arr2 [ index2 ] = arr2 [ index2 ] , arr1 [ i ] NEW_LINE break NEW_LINE DEDENT elif ( diff2 > diff1 ) : NEW_LINE INDENT arr2 [ i ] , arr1 [ index1 ] = arr1 [ index1 ] , arr2 [ i ] NEW_LINE break NEW_LINE DEDENT elif ( diff1 == diff2 ) : NEW_LINE INDENT if ( index1 <= index2 ) : NEW_LINE INDENT arr2 [ i ] , arr1 [ index1 ] = arr1 [ index1 ] , arr2 [ i ] NEW_LINE break NEW_LINE DEDENT elif ( index2 <= index1 ) : NEW_LINE INDENT arr1 [ i ] , arr2 [ index2 ] = arr2 [ index2 ] , arr1 [ i ] NEW_LINE break ; NEW_LINE DEDENT DEDENT DEDENT