Calculate New count by removing all numbers in range [ l , r ] occurring exactly once
var elem1 ; if ( l != 0 ) elem1 = count1 [ r ] - count1 [ l - 1 ] ; else elem1 = count1 [ r ] ; if ( count - elem1 >= maxcoverage ) { maxcoverage = count - elem1 ; maxindex = i ; } } document . write ( " " + maxcoverage + " " + maxindex ) ; }