HELP NEEDED ON DFS
i believe my code runs in 0(n) . but still it fails .\nis my approach wrong ? \nim just doing normal dfs.\n\n\nclass Solution {\nSet<Integer>visited=new HashSet
i believe my code runs in 0(n) . but still it fails .\nis my approach wrong ? \nim just doing normal dfs.\n\n```\nclass Solution {\nSet<Integer>visited=new HashSet<>();\n    public boolean canReach(String str, int minJump, int maxJump) {\n        \n        if(str.charAt(str.length()-1)==\'1\') return false;\n        return isPossible(str,0,minJump,maxJump);\n        \n    }\n\n    public boolean isPossible(String s,int cur,int min,int max)\n    {\n\t\tif(visited.contains(cur)) return false;\n        visited.add(cur);\n        int start=cur+min;\n        int end=Math.min(cur+max,s.length()-1);\n        if(start>end) return false;\n        if(end==s.length()-1) return true;\n\n        boolean ans=false;\n        for(int i=start;i<=end && !ans ;i++)\n        {\n            if(s.charAt(i)==\'0\')\n            {\n                ans=ans||isPossible(s,i,min,max);\n            }\n        }\n        return ans;\n    }\n}\n```
['Depth-First Search', 'Recursion']