Driver Code
let arr = [ 2 , 7 , 1 , 4 ] ; let n = arr . length ; let K = 7 ; let v = maxSubArray ( arr , n , K ) ; document . write ( " " ) ; let first = true ; for ( let x = 0 ; x < v . length ; x ++ ) { if ( ! first ) { document . write ( " " ) ; } else { first = false ; } document . write ( " " ) ; let ff = true ; for ( let y = 0 ; y < v [ x ] . length ; y ++ ) { if ( ! ff ) { document . write ( " " ) ; } else { ff = false ; } document . write ( v [ x ] [ y ] ) ; } document . write ( " " ) ; } document . write ( " " ) ;