If we 're not on the  leftmost, we can consider  the left value.
if ( j > 0 ) { int tempMax = Math . max ( maxPath [ i ] [ j - 1 ] * arr [ i ] [ j ] , minPath [ i ] [ j - 1 ] * arr [ i ] [ j ] ) ; maxVal = Math . max ( maxVal , tempMax ) ; int tempMin = Math . min ( maxPath [ i ] [ j - 1 ] * arr [ i ] [ j ] , minPath [ i ] [ j - 1 ] * arr [ i ] [ j ] ) ; minVal = Math . min ( minVal , tempMin ) ; }