How would we go about testing all combinations of subarrays in a array where length of each subarray is equal to P times the sum of subarray elements.
A brief example: Edit:
A = [2,-1,3,0,1,2,1] , P =2
Desired result:
- Length = 2,P * Sum of elements = 1 . Subarrays are
[2,-1] , [0,1]
Edit Constraint :
N represents number of elements in an array
1 <= N <= 1e5
-1000 <= P <= 1000
|A[i]| <= 1e6
What kind of problem set(for eg:NP-hard?) does these kind of questions fall into ? Language : C#