Find an array of size N having exactly K subarrays with sum S | Function to find array with K subarrays with sum S ; Driver Code ; Function call
function SubarraysWithSumS ( n , k , s ) { for ( let i = 0 ; i < k ; i ++ ) document . write ( s + " " ) ; for ( let i = k ; i < n ; i ++ ) document . write ( s + 1 + " " ) ; } let n = 4 , k = 2 , s = 3 ; SubarraysWithSumS ( n , k , s ) ;