Find an N | Function to find an N - length binary string having maximum sum of elements from all given ranges ; Iterate over the range [ 1 , N ] ; If i is odd , then print 0 ; Otherwise , print 1 ; Driver Code ; Function Call
function printBinaryString ( arr , N ) { for ( let i = 1 ; i <= N ; i ++ ) { if ( i % 2 ) { document . write ( 0 ) ; } else { document . write ( 1 ) ; } } } let N = 5 , M = 3 ; let arr = [ [ 1 , 3 ] , [ 2 , 4 ] , [ 2 , 5 ] ] ; printBinaryString ( arr , N ) ;