please check my code;
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t–>0){
int n=sc.nextInt();
int m=sc.nextInt();
System.out.println(helper(n,m));
}
}
private static int helper(int n,int m){
if(n==1 ){
return 1;
}
if(n==0)
return 1;
if(n<0)
return 0;
return helper(n-1,m) +helper(n-m,m);
}
}