title: Why my method of leetcode recursive backtracking is wrong for using such parameter?
body: <p>I was trying to solve Leetcode JumpGame using a recursive backtracking problem by the following method. It is wrong, but my answer is just one variable name different than the solution. I used &quot;position&quot; instead of &quot;nextPosition&quot; in the recursion. Can you help me with the reason?</p>
  <p>My code:</p>
  <pre><code>class Solution {
      public boolean canJump(int[] nums) {
          int location=0;
          int end=nums.length-1;
          return backtrack(nums,location,end);
      
      }
      private boolean backtrack(int[] nums, int location, int end){
          //end condition
          if(location==end){
             return true;
          }
          //recursion 
          for(int i=1;i&lt;=nums[location];i++){
              location=Math.min(location+i,end);  //jump! location updated
              if(backtrack(nums,location,end)){
                  return true;
              }
          }
          return false;
      }
  }
  </code></pre>
  <p>Solution:</p>
  <pre><code>public class Jumpgame55 {
      public boolean canJump(int[] nums) {
          int location = 0;
          int end = nums.length - 1;
          return backtrack(nums, location, end);
  
      }
  
      private boolean backtrack(int[] nums, int location, int end) {
          //end condition
          if (location == end) {
              return true;
          }
          //recursion
          for (int i = 1; i &lt;= nums[location]; i++) {
              int nextlocation = Math.min(location + i, end);  //jump! location updated
              if (backtrack(nums, nextlocation, end)) {
                  return true;
              }
          }
          return false;
      }
  }
  </code></pre>