# Given an array, find all unique subsets with a given sum with allowed repeated digits.

**Objective: **Given an array of integers and number N, Write an algorithm to find and print all the unique subsets of array for which sum is equal to N where array elements can be repeated any number of times.

**Example:**

int [] arrA={2,4,3} sum =6 Output: [2, 2, 2] [2, 4] [3, 3] int [] arrA={2,6,3,5} Sum = 8 [2, 2, 2, 2] [2, 3, 3] [2, 6] [3, 5]

**Approach: Use Recursion**

- Given
and*arrA[]*.*sum* - Sort the
in ascending order.*arrA[]* - Start with
= 0,*currSum*= 0,*startIndex*=null*combinationList* - Iterate through
=*i*to*startIndex*.*length(arrA[])*- Add
to*arrA[i]*.*currSum* - Put
to*arrA[i]**combinationList.* - Make a recursive call with
(to process next elements) and*startIndex**combinationList.* - In tail recursion, backtrack and remove
from the*arrA[i]*to find more solutions*combinationList* - Base case: if
*currSum=sum*.*combinationList*

- Add

**Complete Code:**

**Output:**

Given Array: [2, 6, 3, 5], required sum: 8 [2, 2, 2, 2] [2, 3, 3] [2, 6] [3, 5]