Prefix Sum | O(N)
\nclass Solution {\npublic:\n    bool canReach(string s, int minJump, int maxJump) {\n        int n = s.length();\n        vector<int> sum(n+1);\n        \n    
```\nclass Solution {\npublic:\n    bool canReach(string s, int minJump, int maxJump) {\n        int n = s.length();\n        vector<int> sum(n+1);\n        \n        int l = min(n-1,minJump);\n        int r = min(n-1,maxJump);\n        \n        sum[l]++;\n        sum[r+1]--;\n        \n        for(int i=1;i<n;i++){\n            sum[i] += sum[i-1];\n            if(s[i]==\'1\')\n                continue;\n            if(sum[i]){\n                if(i==n-1)\n                    return true;\n                l = i + minJump;\n                r = min(n-1,i + maxJump);\n                if(l<=r){\n                    sum[l]++;\n                    sum[r+1]--;\n                }\n            }\n        }\n        \n        return false;\n    }\n};\n```
[]