Please share the code?

discuss the algorithm for this question along with the code

@namangarg31
Algorithm :

  • Sort the array(non-decreasing).
  • First remove all the duplicates from array.
  • Then use recursion and backtracking to solve the problem.
      1. If at any time sub-problem sum == 0 then add that array to the result (vector of vectors).
      1. Else if sum if negative then ignore that sub-problem.
      1. 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
        editorial code -(https://ide.codingblocks.com/s/266261)
        dont forget to hit like and mark resolved if cleared :smiley: