look left
if ( j > 0 && abs ( mat [ i ] [ j - 1 ] - mat [ i ] [ j ] ) == 1 ) { lookup [ i ] [ j ] = max ( lookup [ i ] [ j ] , lookup [ i ] [ j - 1 ] + 1 ) ; if ( max_len < lookup [ i ] [ j ] ) { max_len = lookup [ i ] [ j ] ; max_row = i , max_col = j ; } } } } } cout << " Maximum ▁ length ▁ of ▁ Snake ▁ sequence ▁ is : ▁ " << max_len << endl ;