class Solution {

public:

int jump(int A[], int n) {

```
if( n == 0 || n == 1){return 0 ;}
int max,jump,index;
jump = 0 ;
int i = n-1;
while ( i >=0 )
{
for(int j = i-1; j >= 0 ; j--)
{
if(A[j] == 0 ){return 0 ;}
if((j+A[j]) >=i)
{
index = j ;
}
}
jump++ ;
i = index ;
if(i == 0 ){break ;}
}
return jump ;
}
```

};