public int jump2(int[] A) {//AC
    	if (A == null || A.length == 0)
    	{
    		return 0;
    	}
    	else
    	{
    		int temp = 0, maxx = 0, num = 0;
    		int len = A.length;
    		for (int i = 0; i < len; )
    		{
    			if (temp >= len-1) break;
    			while (i <= temp)
    			{
    				maxx = Math.max(maxx, i+A[i]);
    				i++;
    			}
    			num++;
    			temp = maxx;
    		}
    		return num;
    	}
    }