title: Max SubArray kadane Algorthim
body: <pre><code>void kadane(int A[], int N, int&amp; bestStart, int&amp; bestEnd, int&amp; bestSum)
  {
  
      int max_ending_here = 0;
      int max_so_far = 0;
      bestStart = 0;
  
  
      for (int i = 0; i &lt; N; i++)
      {
  
          max_ending_here += A[i];
  
          if (max_ending_here &lt; 0)
          {
              max_ending_here = 0;
          }
          if (max_ending_here &gt; max_so_far)
          {
              max_so_far = max_ending_here;
              bestEnd = i;
          }
  
      }
  }
  </code></pre>
  
  <p>I want to update the best start index
  If I have an array A={-1,-2,5,0,1}
  Best start should be index 2 and best end index 4 I am getting the best end but i do not know how to update the best start
  Max sub array here is = 6 (5+0+1)</p>