public int jump(int[] A) {//TLE
    	int len = A.length;
    	int temp[] = new int[len];
    	for (int i = 1; i < len; ++i)
    	{
    		temp[i] = -1;
    	}
    	int j;
    	for (int i = 0; i < A.length; ++i)
    	{
    		j = i+1;
    		while (j < A.length && j <= i + A[i])
    		{
    			if (temp[j] == -1)
    			{
    				temp[j] = temp[i] + 1;
    			}
    			else
    			{
    				temp[j] = Math.min(temp[j], temp[i]+1);
    			}
    			j++;
    		}
    	}
        return temp[len-1];
    }