Loop to store the starting and end range in the array
for ( let pr = 0 ; pr < vec . length ; pr ++ ) { a . push ( vec [ pr ] [ 0 ] ) ; b . push ( vec [ pr ] [ 1 ] ) ; } a . sort ( function ( c , d ) { return c - d ; } ) ; b . sort ( function ( c , d ) { return c - d ; } ) ; let left , right , ans ;