Simple linear scan of array, O(n)
This problem is similar to others in the jump game series.\n\nKey idea: if we start searching from left to right, then the jumpable interval will be strictly in
This problem is similar to others in the jump game series.\n\nKey idea: if we start searching from left to right, then the jumpable interval will be strictly increasing.\nFrom `k` we can reach `[k + minJump, k + maxJump]`, thus if `i < j`, then the left bound of corresponding interval of `j` must be on the right of that of `i`.\n\nSo for indices less than `k + minJump`, we never need to consider them again, since their reachability won\'t change any more.\nFor indices between `k + minJump` and `k + maxJump`, their reachability has been decided by `k`, therefore there\'s no need to consider them either.\n\nHence `k + maxJump + 1` can be used as a monotonically increasing lower bound to start our search, and we can safely ignore indices to the left of it.\n\n```\nclass Solution {\n    public boolean canReach(String s, int minJump, int maxJump) {\n        int n = s.length();\n        boolean[] reachable = new boolean[n];\n        reachable[0] = true;\n        \n        int lower = 0;\n        for (int i = 0; i < n; ++i) {\n            if (reachable[i]) {\n                int upper = Math.min(i + maxJump, n - 1);\n                for (int j = Math.max(lower, i + minJump); j <= upper; ++j) {\n                    if (s.charAt(j) == \'0\') {\n                        reachable[j] = true;\n                    }\n                }\n                lower = upper + 1;\n            }\n        }\n        return reachable[n - 1];\n    }\n}\n```
['Java']