Given an array of integers and a number x. We have to find sum of subarray having maximum sum less than or equal to given value of x.
The first line of input contains an integer T denoting the number of test cases. The first line of each test case consists of an integer n. Next line of each test case consists of n spaced integers.The next line consists of an integer x.
Print the maximum sum of any subarray that is less than or equal to x.
1 2 3 4 5
2 4 6 8 10
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.