Question: PLEASE USING RECURSION, NO LOOPS AT ALL Given an array inp arr [ ] of non - negative integers and an integer sum, find a

PLEASE USING RECURSION, NO LOOPS AT ALL
Given an array inp arr[] of non-negative integers and an integer sum,
find a contiguous subarray that adds to the given sum.
Note: There may be more than one subarray with the sum as the given sum;
print the first such subarray.
int inp_arr[10]={9,7,2,4,25,23,2,8,10,20};
Example 1: int target_sum =18;//
Output: The target sum of 18 can be found from start index: 0 to the end index: 2
Example 2: int target_sum =10;//
Output: The target sum of 10 can be found from start index: 6 to the end index: 7
Example 3: int target_sum =11;//
Output: The target sum of 11 can not be found.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!