Given an array of n elements(both +ve -ve allowed)
Find all the subarrays with a given sum k!
I know the solution using dynamic programming. It has to be done by
recursion (as asked by the interviewer)
For ex
arr = 1 3 1 7 -4 -11 3 4 8
k = 12
answer = {1 3 1 7}, {4 8}, {1 3 1 7 -4 -11 3 4 8}
You have to print {from index, to last index} so for above example {0, 3};
{0,8}; {7,8} is the answer
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].