Wa on all test cases

Why is this wrong?

@alamsarfraz422
hey sarfraz in this question at a point i we have to minimize it using any of the prevous points from where we can jump on point i

int minJumps(int arr[], int n) 
{ 
    // jumps[n-1] will hold the result 
    int* jumps = new int[n]; 
    int i, j; 

    if (n == 0 || arr[0] == 0) 
        return INT_MAX; 

    jumps[0] = 0; 

    // Find the minimum number of jumps to reach arr[i] 
    // from arr[0], and assign this value to jumps[i] 
    for (i = 1; i < n; i++) { 
        jumps[i] = INT_MAX; 
        for (j = 0; j < i; j++) { 
            if (i <= j + arr[j] && jumps[j] != INT_MAX) { 
                jumps[i] = min(jumps[i], jumps[j] + 1); 
                break; 
            } 
        } 
    } 
    return jumps[n - 1]; 
}

so we need to check one condition that i<=j+arr[j] so that we can reach to i from point j and point j value is not INT_MAX (like we can reach point j ) so we try to minimize ans for position i and this will be done for all positions of i
if it is clear mark it as resolved and rate my experience

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.