Sir my code is producing correct output but test case is failing please tell me the logic is right or mot and please debug this
/******************************************************************************
Online Java Compiler.
Code, Compile, Run and Debug java program online.
Write your code in this editor and press “Run” button to execute it.
*****************************************************************************/
import java.util.;
public class sumitup
{
public static ArrayList ar=new ArrayList<>();
public static ArrayList at=new ArrayList<>();
public static int count=0;
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
//int n=s.nextInt();
int A[]=new int[] {10,1,2,7,6,1,5};
/
* for(int i=0;i<n;i++) { A[i]=s.nextInt(); }
*/
per(A,0,0,8," ");
}
public static void per(int arr[],int k,int idx,int total,String ans){
if(total==0){
count++;
System.out.println(count+" "+ans);
return;
}
int ars[]=new int[6];
for(int i=k;i<arr.length;i++){
int count=0;
ars[count]=arr[i];
count++;
if(arr[i]<=total && arr[i]!=arr[idx]){
if(i>=idx){
per(arr,k+i,idx+1,total-arr[i],ans+""+arr[i]);
// k=0;
}
}
}
}
}
I have try it many times