Minimum jumps required - challenges

I have written the DP code for this problem which is working fine while I am compiling and testing with custom input. However, I am getting wrong answer when I am submitting it.
So I downloaded the editorial and saw that the code matches with the editorial except the fact that mine is in C++.
I went to unclock the test cases but it’s not being unlocked. Why is that happening?

I am also attaching my code.

#include
using namespace std;
#include
int main() {
int t;
cin>>t;
while(t–){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
int dp[n];

	dp[0]=0;
	for(int i=1;i<n;i++){
		dp[i]=INT_MAX;
		for(int j=0;j<i;j++){
			if(j==0 || (j!=0 && arr[j]!=0)){
				if(i-j<=arr[j]){
					dp[i]=min(dp[i], dp[j]+1);
				}
			}
		}
	}
	cout<<dp[n-1];
}
return 0;

}

@Ishita28 For the test cases not unlocking. You can write your problem to [email protected]

@Ishita28 For the code correction please send me the link of the problem. As I think your solution is correct.

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.