DP +Suffix Sum
\n\n# Code\n\nclass Solution {\npublic:\n    bool canReach(string s, int minJump, int maxJump) {\n        int n=s.size();\n        if(s[n-1]!=\'0\') return fals
\n\n# Code\n```\nclass Solution {\npublic:\n    bool canReach(string s, int minJump, int maxJump) {\n        int n=s.size();\n        if(s[n-1]!=\'0\') return false;\n\n        vector<bool> dp(n);\n        vector<int> suff(n);\n        suff[n-1]=1;\n        dp[n-1]=true;\n\n        for(int i=n-2;i>=0;i--){\n            int l=i+minJump;\n            int r=min(i+maxJump,n-1);\n            if(s[i]==\'1\' or l>n-1){\n                dp[i]=false;\n                suff[i]=suff[i+1];\n                continue;\n            }\n            else{\n                int cnt=suff[l]-((r==n-1)?0:suff[r+1]);\n                \n                if(cnt>0){\n                    dp[i]=true;\n                    suff[i]=suff[i+1]+1;\n                }\n                else{\n                    dp[i]=false;\n                    suff[i]=suff[i+1];\n                }\n            }\n        }\n        return dp[0];\n\n    }\n};\n```
['Dynamic Programming', 'Suffix Array', 'C++']