What is the problem in this program

package Test;

import java.io.*;
import java.util.Scanner;

class Test {

// function to count the total number of ways 
static int countWays(int n, int m) 
{ 
    // table to store values 
    // of subproblems 
    int count[] = new int[n + 1]; 
    count[0] = 0; 

    // Fill the table upto value n 
    int i; 
    for (i = 1; i <= n; i++) { 

        // recurrence relation 
        if (i > m) 
            count[i] = count[i - 1] + count[i - m]; 

        // base cases 
        else if (i < m || i == 1) 
            count[i] = 1; 

        // i = = m 
        else
            count[i] = 2; 
    } 

    // required number of ways 
    return count[n]; 
} 

// Driver program 
public static void main(String[] args) 
{ 
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int m=sc.nextInt();
    System.out.println(countWays(n, m)); 
} 

}

@Ashi,
https://ide.codingblocks.com/s/243481 corrected code.

Errors:

  1. Take number of test cases as input too. Read the input format given in the question correctly.
  2. Take mod of count[i] after every iteration with 1000000007 as mentioned in the question.
  3. Use long instead of int.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.