Minimum Number of Jumps : one test case failing

import java.util.*;

public class Main {

public static void main(String [] args) throws Exception
{
	Scanner s = new Scanner(System.in);
	
	int t = s.nextInt();
	
	int n;
	
	while(t-- != 0)
	{
		n = s.nextInt();
		int [] A = new int [n];
		
		for(int i = 0; i<n; i++)
			A[i] = s.nextInt();
		

		int [] strg = new int[n];

		System.out.println(minJumps(A, 0, n-1, strg));
	}
	
	
}



//recursion
public static int minJumps(int [] A, int si, int ei, int [] strg)
{
	
	if(si > ei || A[si] == 0)
		return Integer.MAX_VALUE;
	
	if(si == ei)
		return 0;

	if(strg[si] != 0)
		return strg[si];
	
	int minAns = Integer.MAX_VALUE;
	int ans;
	
	for(int i = 1; i<=A[si]; i++)
	{
		ans = minJumps(A, si + i, ei, strg);
		
		if(ans < minAns)
			minAns = ans;
	}
	

	strg[si] = minAns != Integer.MAX_VALUE ? minAns + 1 : minAns;
	
	return strg[si];
}

}

Please Help Fast!!!

Just adjust the a[si] == 0 check below the si == ei check

It may be the case that si == ei and simultaneously a[si] == 0 … so in that case your program should return 0 but instead it would be returning int.max_value and that is the case where ur program is failing

thanks bro its working now