[Python3] Greedy O(n)
min_i and max_i are the range of positions that we can reach for the next step. If at some point we find the last index in this range, that means the last index
min_i and max_i are the range of positions that we can reach for the next step. If at some point we find the last index in this range, that means the last index is reachable. If my current index i is greater than max_i, we can\'t reach this position and won\'t be able to continue jumping. We ignore those \'invalid\' position (s[i] == 1 or i < min_i) because we can\'t jump from these positions.\n```\nclass Solution:\n    def canReach(self, s: str, minJump: int, maxJump: int) -> bool:\n        if s[-1] == \'1\':\n            return False\n        n = len(s)\n        min_i = max_i = 0\n        for i in range(n-1):\n            if s[i] == \'1\' or i < min_i:\n                continue\n            if i > max_i:\n                return False\n            min_i = i + minJump\n            max_i = min(i + maxJump, n-1)\n            if min_i <= n-1 <= max_i:\n                return True\n        return False\n```
['Greedy', 'Python']