import java.util.;
import java.lang.;
import java.io.*;
/* Name of the class has to be “Main” only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
int arr[] = {1,1,2,5,6,7,10};
int t = 8;
sumItUp(arr,8,"",0);
}
public static void sumItUp(int[] arr, int amount, String ans, int lastIndex) {
if (amount == 0) {
System.out.println(ans);
return;
}
for (int i = lastIndex; i < arr.length; i++) {
sumItUp(arr, amount-arr[i], ans + arr[i] + " ", i + 1);
}
}
}
it is printing 2 times the same thing
how to solve