Easy || Beats 90% || Dynamic Programming || Recursive || Sliding Window
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    bool solve(int idx, string &s, int minJ, int maxJ, vector<int> &dp){\n        if(idx >= s.length() || s[idx] == \'1\') return false;\n        if(idx == s.length() - 1) return true;\n        if(dp[idx]!=-1) return dp[idx];\n        dp[idx] = false;\n        for(int i = minJ; i<= maxJ; i++){\n            if(solve(idx + i, s, minJ, maxJ, dp)) return dp[idx] = true;\n        }\n        return dp[idx];\n    }\n    bool canReach(string s, int minJump, int maxJump) {\n        if(s[s.length() - 1] == \'1\') return false;\n        // applying sliding window in order to save time and reduce time complexity\n       \n        int cnt = 0;\n      \n        for(int i = 0; i<s.length(); i++){\n            if(s[i] == \'1\'){\n                cnt++;\n                if(cnt >= maxJump) return false;\n            }\n            else{\n                cnt = 0;\n            }\n        }\n        vector<int> dp(s.length(), -1);\n        return solve(0, s, minJump, maxJump, dp);\n    }\n};\n```
['Dynamic Programming', 'Recursion', 'Sliding Window', 'C++']