Calculate New count by removing all numbers in range [ l , r ] occurring exactly once
int elem1 ; if ( l != 0 ) elem1 = count1 [ r ] - count1 [ l - 1 ] ; else elem1 = count1 [ r ] ; if ( count - elem1 >= maxcoverage ) { maxcoverage = count - elem1 ; maxindex = i ; } } cout << " Maximum ▁ Coverage ▁ is ▁ " << maxcoverage << " ▁ after ▁ removing ▁ interval ▁ at ▁ index ▁ " << maxindex ; }