Find minimum value from right for every index
int right_min [ n + 1 ] ; right_min [ n ] = INT8_MAX ; for ( int i = n - 1 ; i >= 0 ; i -- ) { right_min [ i ] = min ( right_min [ i + 1 ] , arr [ i ] ) ; }