Compute LIS values from left to right
for i in range ( 1 , N ) : NEW_LINE INDENT for j in range ( 0 , i ) : NEW_LINE INDENT if ( ( arr [ i ] < arr [ j ] ) and ( lds [ i ] < lds [ j ] + 1 ) ) : NEW_LINE INDENT lds [ i ] = lds [ j ] + 1 NEW_LINE DEDENT DEDENT DEDENT