Select the path we are going to follow
for i in range ( 1 , N ) : NEW_LINE INDENT for j in range ( M ) : NEW_LINE INDENT sum = max ( sum , b [ i ] [ j ] + b [ i - 1 ] [ j ] ) ; NEW_LINE b [ i ] [ j ] = max ( b [ i ] [ j ] , b [ i - 1 ] [ j ] + arr [ i ] [ j ] ) ; NEW_LINE DEDENT DEDENT return sum ; NEW_LINE