Find maximum value of size of LIS [ i ] + size of LDS [ i ] - 1
if ( len ( LIS [ i ] ) + len ( LDS [ i ] ) - 1 > max ) : NEW_LINE INDENT max = len ( LIS [ i ] ) + len ( LDS [ i ] ) - 1 NEW_LINE maxIndex = i NEW_LINE DEDENT