memory optimized BFS
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n"""https://leetcode.com/problems/jump-game-vii/"""\n"""memory optimized BFS that makes use of movement in one direction"""\n\n\nclass Solution:\n    def canReach(self, s: str, minJump: int, maxJump: int) -> bool:\n        n = len(s)\n        q, farthest_idx = [0], 0\n\n        # typical BFS, but the visited flag is not required as move \n        # only in one direction\n        while q:\n            idx = q.pop(0)\n            if idx == (n - 1):\n                return True\n            # ideally the range should be range(idx + minJump, min(idx + maxJump + 1, n))\n            # however, since we keep moving in one direction only, we can make use of the \n            # farthest we have already explored\n            for new_idx in range(max(idx + minJump, farthest_idx + 1), min(idx + maxJump + 1, n)):\n                if s[new_idx] == "0":\n                    q.append(new_idx)\n            # this is useful for preventing memory explosion\n            farthest_idx = idx + maxJump\n\n        return False\n```
['Python3']