Finding the maximum and the minimum element from the modified array after the operations
int min = INT_MAX ; int max = INT_MIN ; for ( int i = 0 ; i <= MAX ; i ++ ) { if ( arr1 [ i ] > 0 ) { if ( min > i ) min = i ; if ( max < i ) max = i ; } }