Count of Subarray having sum >= k and length >l

For a given array we need to find the maximum number of subarrays possible. Conditions:

1.The sum of each subarray should be >= minSum

2.The length of the subarray should be >= minLen

We need to find the maximum number of subarray possible in the given array.

Ex: n=6 array= [5, 7, 9, 12, 10, 13] minLen = 2 minSum = 15

Output: 2
Explanation:
Since the min length of the sub-array should be > 2 && sum should be >minSum so the two subarray will be as 7+9+12=28 and 10+13 =23

Comments (1)