Stores lIS from tempArr [ ]
tail = [ ] NEW_LINE tail . append ( tempArr [ 0 ] ) NEW_LINE for i in range ( 1 , len ( tempArr ) ) : NEW_LINE INDENT if ( tempArr [ i ] > tail [ - 1 ] ) : NEW_LINE INDENT tail . append ( tempArr [ i ] ) NEW_LINE DEDENT elif ( tempArr [ i ] < tail [ 0 ] ) : NEW_LINE INDENT tail [ 0 ] = tempArr [ i ] NEW_LINE DEDENT else : NEW_LINE INDENT it = bisect_left ( tail , tempArr [ i ] ) NEW_LINE it = tempArr [ i ] NEW_LINE DEDENT DEDENT return len ( tail ) NEW_LINE