Store all endpoints of type1 ranges
end . push ( type1 [ i ] [ 1 ] ) ; } start . sort ( function ( a , b ) { return a - b ; } ) ; end . sort ( function ( a , b ) { return a - b ; } ) ; for ( let i = 0 ; i < m ; i ++ ) {