def jump(self, A):
        """
        Simplified bfs, use pointers to scan the array.
        Algorithm: Two Pointers

        gmax, record the max reachable index (absolute position) from the sliding window
        :param A: a list of integers
        :return: integer, minimum number of jumps
        """
        length = len(A)
        counter = 0

        start = 0
        end = 1  # max reach [0, 1)
        gmax = 0
        while end<length:  # when end==length, it has already reached the last item
            if not start<end: return 0  # avoid dead loop
            for i in xrange(start, end):
                gmax = max(gmax, A[i]+i)

            counter += 1
            start = end
            end = gmax+1

        return counter
dataset/ETHPy150Open algorhythms/LeetCode/044 Jump Game II.py/Solution.jump/original