Find the smallest and the largest element in arr2
for ( i = 0 ; i < m ; i ++ ) { smallest = Math . max ( smallest , arr2 [ i ] ) ; largest = Math . min ( largest , arr1 [ i ] ) ; } for ( i = 0 ; i < n ; i ++ ) {