title: Zero sum minimal subarray
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/5534063/zero-sum-subarray">Zero sum SubArray</a>  </p>
  </blockquote>
  
  
  
  <blockquote>
    <p>An array contains both positive and negative elements, find the
    subarray whose sum equals 0.</p>
  </blockquote>
  
  <p>This is an interview question. 
  Unfortunately, I cannot read the accepted answer to this <a href="https://stackoverflow.com/questions/5534063/zero-sum-subarray">question</a>, so I am asking it again: how to find the minimal integer subarray with zero sum?</p>
  
  <p>Note, this is not a "zero subset problem". The obvious brute-force solution is O(N^2) (loop over all subarrays). Can we solve it in O(N)? </p>