i am not able to form the code for this problem .
pls tell the correct code.
Sum it up problem
I have provided you with pseudo code, please try to code it. if problem persists give me the code, i’ll point out the mistake.
Sort the array(non-decreasing).
First remove all the duplicates from array.
Then use recursion and backtracking to solve the problem.
- If at any time sub-problem sum == 0 then add that array to the result (vector of vectors).
- Else if sum if negative then ignore that sub-problem.
- Else insert the present array in that index to the current vector and call the function with sum = sum-ar[index] and index = index, then pop that element from current index (backtrack) and call the function with sum = sum and index = index+1
getting some errors…can you provide the code