Compare current value with maximum and minimum values in the next index
suffix [ i , 0 ] = Math . Max ( suffix [ i + 1 , 0 ] , arr [ i ] ) ; suffix [ i , 1 ] = Math . Min ( suffix [ i + 1 , 1 ] , arr [ i ] ) ; } } }