Stores lIS from tempArr [ ]
vector < int > tail ; tail . push_back ( tempArr [ 0 ] ) ; for ( int i = 1 ; i < tempArr . size ( ) ; i ++ ) { if ( tempArr [ i ] > tail . back ( ) ) tail . push_back ( tempArr [ i ] ) ; else if ( tempArr [ i ] < tail [ 0 ] ) tail [ 0 ] = tempArr [ i ] ; else { auto it = lower_bound ( tail . begin ( ) , tail . end ( ) , tempArr [ i ] ) ; * it = tempArr [ i ] ; } } return ( int ) tail . size ( ) ; }