BFS, Greedy O(N) Simple Java Solution
Intuition\n Describe your first thoughts on how to solve this problem. \nUsing BFS. We get a range of values that we can choose from for processing.\nSolution b
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nUsing BFS. We get a range of values that we can choose from for processing.\nSolution based on NeetCode\'s Jump Game II.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\nleft and right pointers start at 0. \nleft moves as left+minJump \nright moves as right+maxJump.\n\nBut while we do this, we have some overlapping cases.\nminJump = 2\nmaxJump = 5\n[0,1,1,0,0,1,1,0]\n1st iteration [-,-,$$l,-,-,r$$,-,-] Range = [2,5]\n2nd iteration [-,-,-,-,$$l,-,-,r$$] Range = [4,7]\n\nSince 4, 5 have already been processed. We can create a farthest variable to keep track of the $$right+1$$ element,\n\n\n\n\n# Complexity\n- Time complexity: O(N)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(N)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public boolean canReach(String s, int minJump, int maxJump) {\n        int left;\n        int right;\n        int farthest = 0;\n\n        Queue<Integer> q = new LinkedList();\n\n        q.add(0);\n        while(!q.isEmpty()){\n            int k = q.remove();\n            if(k == s.length()-1) return true;\n       \n            left = Math.max(k + minJump, farthest);\n            right = Math.min(k + maxJump, s.length()-1);\n            for(int i = left; i<= right; i++){\n                if(s.charAt(i)==\'0\') q.add(i);\n            }\n\n            farthest = right+1;\n        }\n        return false;\n    }\n}\n```
['Java']