for every j less than i
for j in range ( i ) : NEW_LINE INDENT if ( ( arr [ j ] < arr [ i ] ) and ( len ( LIS [ j ] ) > len ( LIS [ i ] ) ) ) : NEW_LINE INDENT LIS [ i ] = LIS [ j ] . copy ( ) NEW_LINE DEDENT DEDENT LIS [ i ] . append ( arr [ i ] ) NEW_LINE