def jump_TLE(self, A):
        """
        bfs
        :param A: a list of integers
        :return: integer, minimum number of jumps
        """
        if not A:
            return 0

        length = len(A)
        counter = 0
        dp = [[] for _ in A]

        q = []
        q.append(0)
        while q:
            current_level = q
            q = []
            for ind in current_level:
                if ind>=length-1:
                    return counter
                for j in xrange(ind+1, ind+A[ind]+1):
                    if j not in current_level:  # avoid duplicate
                        q.append(j)
            counter += 1
        return counter
dataset/ETHPy150Open algorhythms/LeetCode/044 Jump Game II.py/Solution.jump_TLE/original