Given an array of integers and a sum, the task is to print all subsets of given array with sum equal to given sum with repetitions allowed.
Examples :
Input : arr = {1, 5, 6}, N = 7
Output :
1 1 1 1 1 1 1
1 1 5
1 5 1
5 1 1
1 6
6 1
I have already gone through related DP questions from https://www.geeksforgeeks.org/perfect-sum-problem-print-subsets-given-sum/ , https://www.geeksforgeeks.org/ways-sum-n-using-array-elements-repetition-allowed/ and find all subsets that sum to a particular value
I haven't found a way or any clues on how to solve this question with repetitions allowed. Any leads would be helpful.