title: Incorrect expected output || Output not matching || Jump Game VII
body: <p>I wrote this code and I think it should give the correct output but its not. When I debug, integer 'i' reaches 8 at the end, so the answer is false. But the expected answer is true. I cant fix my code. I cant even understand why the expected answer is true?? Need help!</p>
  <p>The idea is to have to pointers 'i' and 'j' and if the condition satisfies, put 'i' == 'j',
  at the end if 'i' == s.length-1 return true.</p>
  <p><a href="https://leetcode.com/problems/jump-game-vii/" rel="nofollow noreferrer">Problem Link</a></p>
  <pre><code>public class Debugger {
  
       public static void main(String[] args) {
          String s = &quot;0000010000&quot;;
          int minJump = 2;
          int maxJump = 5;
          System.out.println(canReach(s,minJump,maxJump));
       }
  
      public static boolean canReach(String s, int minJump, int maxJump) {
          int i = 0;
          int j =0;
          int count = 0;
          while(i&lt;s.length() &amp;&amp; j&lt;s.length()){
              if(intAt(s,j)==1){
                  count++;
              }
              if(i + minJump &lt;= j &amp;&amp; j&lt;=Math.min(i+maxJump,s.length()-1)  &amp;&amp; intAt(s,j)==0){
                  i=j;
                  if(i==s.length()-1){
                      return true;
                  }
              }
              j++;
          }
  
          if(count==0 &amp;&amp; minJump!=maxJump){
              return true;
          }
          return false;
      }
  
  
      static int intAt(String s, int index)
      {
          int r = Integer.parseInt(s.substring(index, index+1));
          return r;
      }
  
  
  }
  </code></pre>