Getting the ( i - 1 ) th max value
for k in range ( 1 , m , 1 ) : NEW_LINE INDENT if ( k != j ) : NEW_LINE INDENT if ( dp [ k ] [ i - 1 ] > mx ) : NEW_LINE INDENT mx = dp [ k ] [ i - 1 ] NEW_LINE DEDENT DEDENT DEDENT