Follow the below steps to implement the idea: Sort the array arr[] and remove all the duplicates from the arr[] then create a temporary vector r. to store every combination and a vector of vector res. Recursively follow: If at any time sub-problem sum == 0 then add that array to the res (vector of vectors). Jan 23, 2023