int minJumps(int a[], int n){
if(n<=1) return 0;
if (n==0) return -1;
if(a[0]==0) return -1;
int jump=1; int maxReach=a[0]; int step= a[0];
for(int i=1; i<n; i++){
if(i==n-1) return jump;
maxReach= max(maxReach,i+a[i]);
step--;
if(step==0){
jump++;
if (i >= maxReach)
return -1;
step= maxReach-i;
} }
return -1;
}