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