C++ Solution for those who was not able to guess sliding window !!!!!!!!!!!
we know that if max length of \'1\' subarray is greater than maxjump we cannot reach the end eg "01111000" maxjump = 3 so before going to dp i just explicitly h
we know that if max length of \'1\' subarray is greater than maxjump we cannot reach the end eg "01111000" maxjump = 3 so before going to dp i just explicitly handled that cases and then used normal dp.\nHope you will like it plz upvote if it helps\n\n\tint rec(string& s,int& minj,int& maxj,int& n,int i,vector<int>& dp)\n    {\n        if(i == n-1)\n            return true;\n        if(dp[i]!=-1)return dp[i];\n        \n        int flag = 0;\n        for(int j=i+minj;j<=min(i+maxj,n-1);j++)\n        {\n            if(s[j]==\'0\')\n            {\n                if(dp[j]==-1)\n                {\n                    if(rec(s,minj,maxj,n,j,dp))\n                    {\n                        flag = 1;\n                        break;\n                    }\n                }\n                else if(dp[j])\n                {\n                    flag = 1;\n                    break;\n                }\n            }\n        }\n        return dp[i] = flag;\n    }\n    bool canReach(string s, int minj, int maxj) {\n        \n        int n = s.size();\n        if(s.back()==\'1\')return false;\n        //////////////////////////////////////\n        int count1 = INT_MIN;\n        int c1 = 0;\n        int index = -1;\n        for(int i=0;i<n;i++)\n        {\n            if(s[i]==\'1\')\n            {\n                c1++;\n                if(c1>=count1)\n                {\n                    count1 = c1;\n                    index = i+1;\n                }\n                count1 = max(count1,c1);\n            }\n            else if(s[i]==\'0\')\n            {\n                c1=0;\n            }\n        }\n        if(count1!=INT_MIN)\n        {\n            if(count1>=maxj)return false;\n        }\n\t\t\n\t\t/////////////////////////////////////\n        vector<int> dp(n,-1);\n        return rec(s,minj,maxj,n,0,dp);\n\t\t}
['Dynamic Programming', 'C', 'C++']