L [ i ] = { Max ( L [ j ] ) } + arr [ i ] where j < i and arr [ j ] . b < arr [ i ] . a
if ( ( arr [ j ] . b < arr [ i ] . a ) && ( L [ j ] . size ( ) > L [ i ] . size ( ) ) ) L [ i ] = L [ j ] ; } L [ i ] . push_back ( arr [ i ] ) ; }