find one with max profit
for ( int i = 0 ; i < L . size ( ) ; i ++ ) if ( findSum ( L [ i ] ) > findSum ( maxChain ) ) maxChain = L [ i ] ; for ( int i = 0 ; i < maxChain . size ( ) ; i ++ ) cout << " ( " << maxChain [ i ] . start << " , ▁ " << maxChain [ i ] . finish << " , ▁ " << maxChain [ i ] . profit << " ) ▁ " ; }