Stores the starting and the ending polets
let L = Array . from ( { length : N } , ( _ , i ) => 0 ) ; let R = Array . from ( { length : N } , ( _ , i ) => 0 ) ; for ( let i = 0 ; i < N ; i ++ ) { L [ i ] = arr [ i ] [ 0 ] ; R [ i ] = arr [ i ] [ 1 ] ; }