public int jump(int[] A) {
    	if (A.length < 2)
    		return 0;
    	Queue<Integer> que = new LinkedList<Integer>();
    	int marks[] = new int[A.length];
    	que.offer(0);
    	while (que.isEmpty() == false)
    	{
    		int idx = que.poll();
    		for (int i = idx + A[idx]; i >= idx + 1; i--)
    			if (i >= A.length - 1)
    				return marks[idx] + 1;
    			else if (i < A.length - 1 && marks[i] == 0)
    			{
  					que.offer(i);
  					marks[i] = marks[idx] + 1;
    			}
    	}
    	return -1;
    }